]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/watchdog/watchdog_dev.c
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[karo-tx-linux.git] / drivers / watchdog / watchdog_dev.c
index faf4e189fe423179cb0261e77a3519a2a2b1c03e..6aaefbad303e0901c2f44d923059bde901168dd2 100644 (file)
@@ -469,8 +469,10 @@ static int watchdog_release(struct inode *inode, struct file *file)
         * or if WDIOF_MAGICCLOSE is not set. If nowayout was set then
         * watchdog_stop will fail.
         */
-       if (test_and_clear_bit(WDOG_ALLOW_RELEASE, &wdd->status) ||
-           !(wdd->info->options & WDIOF_MAGICCLOSE))
+       if (!test_bit(WDOG_ACTIVE, &wdd->status))
+               err = 0;
+       else if (test_and_clear_bit(WDOG_ALLOW_RELEASE, &wdd->status) ||
+                !(wdd->info->options & WDIOF_MAGICCLOSE))
                err = watchdog_stop(wdd);
 
        /* If the watchdog was not stopped, send a keepalive ping */