[PATCH 04/15] watchdog/mpcore_wdt: remove multiple 'ret = 0' statements from ioctl ops
Viresh Kumar
viresh.kumar at st.com
Wed Mar 7 05:27:45 EST 2012
mpcore_wdt_ioctl() has many lines where we do
ret = 0;
Rewrite this routine to optimize these writes.
Signed-off-by: Viresh Kumar <viresh.kumar at st.com>
---
drivers/watchdog/mpcore_wdt.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c
index daa6658..89e8fae 100644
--- a/drivers/watchdog/mpcore_wdt.c
+++ b/drivers/watchdog/mpcore_wdt.c
@@ -217,7 +217,7 @@ static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
struct mpcore_wdt *wdt = file->private_data;
- int ret;
+ int ret = 0;
union {
struct watchdog_info ident;
int i;
@@ -235,30 +235,24 @@ static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd,
switch (cmd) {
case WDIOC_GETSUPPORT:
uarg.ident = ident;
- ret = 0;
break;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
uarg.i = 0;
- ret = 0;
break;
case WDIOC_SETOPTIONS:
- ret = -EINVAL;
- if (uarg.i & WDIOS_DISABLECARD) {
+ if (uarg.i & WDIOS_DISABLECARD)
mpcore_wdt_stop(wdt);
- ret = 0;
- }
- if (uarg.i & WDIOS_ENABLECARD) {
+ else if (uarg.i & WDIOS_ENABLECARD)
mpcore_wdt_start(wdt);
- ret = 0;
- }
+ else
+ ret = -EINVAL;
break;
case WDIOC_KEEPALIVE:
mpcore_wdt_keepalive(wdt);
- ret = 0;
break;
case WDIOC_SETTIMEOUT:
@@ -270,7 +264,6 @@ static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd,
/* Fall */
case WDIOC_GETTIMEOUT:
uarg.i = mpcore_margin;
- ret = 0;
break;
default:
--
1.7.8.110.g4cb5d
More information about the linux-arm-kernel
mailing list