Skip to content

Commit

Permalink
watchdog: core: fix WDIOC_GETSTATUS return value
Browse files Browse the repository at this point in the history
In commit 7a87982 we added
a wrapper for the WDIOC_GETSTATUS ioctl call. The code results
however in a different behaviour: it returns an error if the
driver doesn't support the status operation. This is not
according to the API that says that when we don't support
the status operation, that we just should return a 0 value.
Only when the device isn't there anymore, we should return an
error.

Signed-off-by: Wim Van Sebroeck <[email protected]>
  • Loading branch information
Wim Van Sebroeck committed Jun 28, 2012
1 parent a089361 commit 8b9468d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/watchdog/watchdog_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
sizeof(struct watchdog_info)) ? -EFAULT : 0;
case WDIOC_GETSTATUS:
err = watchdog_get_status(wdd, &val);
if (err)
if (err == -ENODEV)
return err;
return put_user(val, p);
case WDIOC_GETBOOTSTATUS:
Expand Down

0 comments on commit 8b9468d

Please sign in to comment.