parisc: set_time() catch errors
PATCH 1/1 parisc: set_time() catch errors
set_rtc_time returns negative on error, ret should be signed to catch those
Signed-off-by Roel Kluin <[email protected]>
---
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);
Quoted 3 lines · Roel Kluin
set_rtc_timereturns negative on error, ret should be signed to catch thoseSigned-off-by Roel Kluin <[email protected]>
Reviewed-by Grant Grundler <[email protected]>
Quoted 6 lines
---
drivers/rtc/rtc-parisc.c +0
-0
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