summaryrefslogtreecommitdiffstats
path: root/sys/arm/at91/at91_st.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arm/at91/at91_st.c')
-rw-r--r--sys/arm/at91/at91_st.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/arm/at91/at91_st.c b/sys/arm/at91/at91_st.c
index 7b63af1..8b61c78 100644
--- a/sys/arm/at91/at91_st.c
+++ b/sys/arm/at91/at91_st.c
@@ -170,10 +170,15 @@ at91st_watchdog(void *argp, u_int cmd, int *error)
uint32_t wdog;
int t;
- wdog = 0;
t = cmd & WD_INTERVAL;
- if (cmd != 0 && t >= 22 && t <= 37)
+ if (cmd > 0 && t >= 22 && t <= 37) {
wdog = (1 << (t - 22)) | ST_WDMR_RSTEN;
+ *error = 0;
+ } else {
+ wdog = 0;
+ if (cmd > 0)
+ *error = EINVAL;
+ }
WR4(ST_WDMR, wdog);
WR4(ST_CR, ST_CR_WDRST);
}
OpenPOWER on IntegriCloud