diff mbox

rtc: t reaches -1, tested 0

Message ID 498EE7D6.4090100@gmail.com
State Accepted, archived
Headers show

Commit Message

roel kluin Feb. 8, 2009, 2:10 p.m. UTC
With a postfix decrement t will reach -1 rather than 0,
so the warning nor errot_out occur.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---

Comments

Manuel Lauss Feb. 8, 2009, 6:23 p.m. UTC | #1
Hey Roel,

On Sun, 08 Feb 2009 15:10:30 +0100
Roel Kluin <roel.kluin@gmail.com> wrote:
> With a postfix decrement t will reach -1 rather than 0,
> so the warning nor errot_out occur.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/rtc/rtc-au1xxx.c b/drivers/rtc/rtc-au1xxx.c
> index 8906a68..979ed04 100644
> --- a/drivers/rtc/rtc-au1xxx.c
> +++ b/drivers/rtc/rtc-au1xxx.c
> @@ -81,7 +81,7 @@ static int __devinit au1xtoy_rtc_probe(struct platform_device *pdev)
>  	if (au_readl(SYS_TOYTRIM) != 32767) {
>  		/* wait until hardware gives access to TRIM register */
>  		t = 0x00100000;
> -		while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T0S) && t--)
> +		while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T0S) && --t)
>  			msleep(1);
>  
>  		if (!t) {

Thank you, obviously correct.

Acked-by: Manuel Lauss <mano@roarinelk.homelinux.net>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---
Alessandro Zummo Feb. 8, 2009, 6:29 p.m. UTC | #2
On Sun, 08 Feb 2009 15:10:30 +0100
Roel Kluin <roel.kluin@gmail.com> wrote:

> With a postfix decrement t will reach -1 rather than 0,
> so the warning nor errot_out occur.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

 Acked-by: Alessandro Zummo <a.zummo@towertech.it>
diff mbox

Patch

diff --git a/drivers/rtc/rtc-au1xxx.c b/drivers/rtc/rtc-au1xxx.c
index 8906a68..979ed04 100644
--- a/drivers/rtc/rtc-au1xxx.c
+++ b/drivers/rtc/rtc-au1xxx.c
@@ -81,7 +81,7 @@  static int __devinit au1xtoy_rtc_probe(struct platform_device *pdev)
 	if (au_readl(SYS_TOYTRIM) != 32767) {
 		/* wait until hardware gives access to TRIM register */
 		t = 0x00100000;
-		while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T0S) && t--)
+		while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T0S) && --t)
 			msleep(1);
 
 		if (!t) {