Parcourir la source

rtc: Fix ioctl error path return

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>
John Stultz il y a 14 ans
Parent
commit
e17fd4ba2a
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      drivers/rtc/rtc-dev.c

+ 2 - 1
drivers/rtc/rtc-dev.c

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