All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] parisc: set_time() catch errors
@ 2008-12-02 23:16 Roel Kluin
  2008-12-03  8:12 ` Grant Grundler
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2008-12-02 23:16 UTC (permalink / raw)
  To: kyle, linux-parisc

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

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/rtc/rtc-parisc.c b/drivers/rtc/rtc-parisc.c
index 346d633..c6bfa6f 100644
--- a/drivers/rtc/rtc-parisc.c
+++ b/drivers/rtc/rtc-parisc.c
@@ -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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] parisc: set_time() catch errors
  2008-12-02 23:16 [PATCH] parisc: set_time() catch errors Roel Kluin
@ 2008-12-03  8:12 ` Grant Grundler
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Grundler @ 2008-12-03  8:12 UTC (permalink / raw)
  To: Roel Kluin; +Cc: kyle, linux-parisc

On Wed, Dec 03, 2008 at 12:16:04AM +0100, Roel Kluin wrote:
> set_rtc_time returns negative on error, ret should be signed to catch those
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Reviewed-by: Grant Grundler <grundler@parisc-linux.org>

> ---
> diff --git a/drivers/rtc/rtc-parisc.c b/drivers/rtc/rtc-parisc.c
> index 346d633..c6bfa6f 100644
> --- a/drivers/rtc/rtc-parisc.c
> +++ b/drivers/rtc/rtc-parisc.c
> @@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-03  8:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-02 23:16 [PATCH] parisc: set_time() catch errors Roel Kluin
2008-12-03  8:12 ` Grant Grundler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.