watchdog: core: Clear WDOG_HW_RUNNING before calling the stop function
[cascardo/linux.git] / drivers / watchdog / watchdog_dev.c
index f128efc..040bf83 100644 (file)
@@ -267,10 +267,12 @@ static int watchdog_stop(struct watchdog_device *wdd)
                return -EBUSY;
        }
 
-       if (wdd->ops->stop)
+       if (wdd->ops->stop) {
+               clear_bit(WDOG_HW_RUNNING, &wdd->status);
                err = wdd->ops->stop(wdd);
-       else
+       } else {
                set_bit(WDOG_HW_RUNNING, &wdd->status);
+       }
 
        if (err == 0) {
                clear_bit(WDOG_ACTIVE, &wdd->status);