]> Pileus Git - ~andy/linux/commitdiff
rtc: Fix ioctl error path return
authorJohn Stultz <john.stultz@linaro.org>
Wed, 1 Jun 2011 06:26:11 +0000 (23:26 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Thu, 2 Jun 2011 02:29:39 +0000 (19:29 -0700)
Bryan Henderson noticed that the  "RTC: Fix rtc driver ioctl specific
shortcutting" commit has a small bug: When an ioctl is called with an
invalid command code and the clock driver does not have an "ioctl"
method, the ioctl returns rc 0 instead of -ENOTTY.

This patch fixes the issue.

CC: Bryan Henderson <bryanh@giraffe-data.com>
CC: Gabor Z. Papp <gzp@papp.hu>
Reported-by: Bryan Henderson <bryanh@giraffe-data.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
drivers/rtc/rtc-dev.c

index d0e06edb14c5157890079b08c4dcfab65b0ec66c..cace6d3aed9a59261bba613af9649b34699fb7a8 100644 (file)
@@ -421,7 +421,8 @@ static long rtc_dev_ioctl(struct file *file,
                        err = ops->ioctl(rtc->dev.parent, cmd, arg);
                        if (err == -ENOIOCTLCMD)
                                err = -ENOTTY;
-               }
+               } else
+                       err = -ENOTTY;
                break;
        }