Skip to contentSkip to conversation

rtc: make example code jump to done instead of return when ioctl not supported

PATCH New Hans-Christian Egtvedt 1 participant 2 messages Jun 8, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 rtc: make example code jump to done instead of return when ioctl not supported

---
 Documentation/rtc.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Documentation/rtc.txt +1 -1
index 1ef6bb8..8cc67c7 100644
@@ -388,7 +388,7 @@ test_PIE:
 		/* not all RTCs support periodic IRQs */
 		if (errno == ENOTTY) {
 			fprintf(stderr, "\nNo periodic IRQ support\n");
-			return 0;
+			goto done;
 		}
 		perror("RTC_IRQP_READ ioctl");
 		exit(errno);
Signature · 1 line
1.4.4.2
#1 lore raw

PATCH 2/2 rtc-dev: return -ENOTTY in ioctl if irq_set_freq is not implemented by driver

---
 drivers/rtc/rtc-dev.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/rtc/rtc-dev.c +2 -0
index 137330b..7f0e749 100644
@@ -306,6 +306,8 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
 	case RTC_IRQP_READ:
 		if (ops->irq_set_freq)
 			err = put_user(rtc->irq_freq, (unsigned long __user *)uarg);
+		else
+			err = -ENOTTY;
 		break;
 
 	case RTC_IRQP_SET:
Signature · 1 line
1.4.4.2