watchdog: xen: don't clear is_active when xen_wdt_stop() failed
authorJan Beulich <JBeulich@suse.com>
Mon, 19 Mar 2012 09:32:28 +0000 (09:32 +0000)
committerWim Van Sebroeck <wim@iguana.be>
Tue, 27 Mar 2012 18:13:55 +0000 (20:13 +0200)
xen_wdt_release() shouldn't clear is_active even when the watchdog
didn't get stopped (which by itself shouldn't happen, but let's return
a proper error in this case rather than adding a BUG() upon hypercall
failure).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
drivers/watchdog/xen_wdt.c

index e04fd6cf2121e044e13058140647b11278b29b67..e4a25b51165c0f5933858e5fe0068a5a7da106b7 100644 (file)
@@ -132,15 +132,17 @@ static int xen_wdt_open(struct inode *inode, struct file *file)
 
 static int xen_wdt_release(struct inode *inode, struct file *file)
 {
+       int err = 0;
+
        if (expect_release)
-               xen_wdt_stop();
+               err = xen_wdt_stop();
        else {
                pr_crit("unexpected close, not stopping watchdog!\n");
                xen_wdt_kick();
        }
-       is_active = false;
+       is_active = err;
        expect_release = false;
-       return 0;
+       return err;
 }
 
 static ssize_t xen_wdt_write(struct file *file, const char __user *data,