Skip to contentSkip to conversation

parisc: set_time() catch errors

PATCH In review Roel Kluin 2 participants 2 messages Dec 2, 2008 – Dec 3, 2008 Real time clock (RTC)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 parisc: set_time() catch errors

set_rtc_time returns negative on error, ret should be signed to catch those

---

drivers/rtc/rtc-parisc.c +2 -1
index 346d633..c6bfa6f 100644
@@ -34,7 +34,8 @@ static int parisc_get_time(struct device *dev, struct rtc_time *tm)
 static int parisc_set_time(struct device *dev, struct rtc_time *tm)
 {
 	struct parisc_rtc *p = dev_get_drvdata(dev);
-	unsigned long flags, ret;
+	unsigned long flags;
+	int ret;
 
 	spin_lock_irqsave(&p->lock, flags);
 	ret = set_rtc_time(tm);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Roel Kluin

set_rtc_time returns negative on error, ret should be signed to catch those

Quoted 6 lines

---

drivers/rtc/rtc-parisc.c +0 -0
index 346d633..c6bfa6f 100644

drivers/rtc/rtc-parisc.c static int parisc_get_time(struct device *dev, struct rtc_time *tm) · line 41

Quoted 9 lines
drivers/rtc/rtc-parisc.c +2 -1
@@ -34,7 +34,8 @@ static int parisc_get_time(struct device *dev, struct rtc_time *tm)
 static int parisc_set_time(struct device *dev, struct rtc_time *tm)
 {
 	struct parisc_rtc *p = dev_get_drvdata(dev);
-	unsigned long flags, ret;
+	unsigned long flags;
+	int ret;
 
 	spin_lock_irqsave(&p->lock, flags);
 	ret = set_rtc_time(tm);

Use of unsigned is wrong given the later code in parisc_set_time() does:

        if (ret < 0)
                return -EOPNOTSUPP;

I expected a compiler "out of range"-like warning. Someone know why no warning was emitted? Or was one emitted and we've just ignored it?

thanks,
grant