diff options
author | Tiejun Chen <tiejun.chen@windriver.com> | 2012-08-06 21:59:40 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2012-08-17 10:03:51 -0400 |
commit | 127c6e731106a2071ee4a6c5a34c471cd3e719f0 (patch) | |
tree | d76424da3d06c61a8395ddb4660d912bdab59ce6 /drivers | |
parent | 09a3017a585eb8567a7de15b426bb1dfb548bf0f (diff) |
booke/wdt: some ioctls do not return values properly
Fix some booke wdt ioctls return value error.
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/watchdog/booke_wdt.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index 3fe82d0e8caa..5b06d31ab6a9 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c | |||
@@ -166,18 +166,17 @@ static long booke_wdt_ioctl(struct file *file, | |||
166 | 166 | ||
167 | switch (cmd) { | 167 | switch (cmd) { |
168 | case WDIOC_GETSUPPORT: | 168 | case WDIOC_GETSUPPORT: |
169 | if (copy_to_user((void *)arg, &ident, sizeof(ident))) | 169 | return copy_to_user(p, &ident, sizeof(ident)) ? -EFAULT : 0; |
170 | return -EFAULT; | ||
171 | case WDIOC_GETSTATUS: | 170 | case WDIOC_GETSTATUS: |
172 | return put_user(0, p); | 171 | return put_user(0, p); |
173 | case WDIOC_GETBOOTSTATUS: | 172 | case WDIOC_GETBOOTSTATUS: |
174 | /* XXX: something is clearing TSR */ | 173 | /* XXX: something is clearing TSR */ |
175 | tmp = mfspr(SPRN_TSR) & TSR_WRS(3); | 174 | tmp = mfspr(SPRN_TSR) & TSR_WRS(3); |
176 | /* returns CARDRESET if last reset was caused by the WDT */ | 175 | /* returns CARDRESET if last reset was caused by the WDT */ |
177 | return (tmp ? WDIOF_CARDRESET : 0); | 176 | return put_user((tmp ? WDIOF_CARDRESET : 0), p); |
178 | case WDIOC_SETOPTIONS: | 177 | case WDIOC_SETOPTIONS: |
179 | if (get_user(tmp, p)) | 178 | if (get_user(tmp, p)) |
180 | return -EINVAL; | 179 | return -EFAULT; |
181 | if (tmp == WDIOS_ENABLECARD) { | 180 | if (tmp == WDIOS_ENABLECARD) { |
182 | booke_wdt_ping(); | 181 | booke_wdt_ping(); |
183 | break; | 182 | break; |