lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sun, 08 Feb 2009 18:46:47 +0100
From:	Roel Kluin <roel.kluin@...il.com>
To:	Mariusz Ceier <mceier@...il.com>
CC:	David Brownell <david-b@...bell.net>,
	spi-devel-general@...ts.sourceforge.net,
	lkml <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] spi: limit reaches -1, tested 0

Mariusz Ceier wrote:
> Roel Kluin writes in first post:
>> -			while ((read(drv_data) == 0) && limit--);
>> +			while ((read(drv_data) == 0) && --limit);
> 
> Roel Kluin writes in last post:
>> -			while ((read(drv_data) == 0) && limit--);
>> +			while ((read(drv_data) == 0) && limit--)
>> +				cpu_relax();
> 
> so should there be postfix or prefix decrement ? :)

Thanks for spotting, I took the liberty to add David Brownell's Acked-by
in this case.
----------------------->8------------------8<---------------------------
With a postfix decrement limit will reach -1 rather than 0,
so the warning will not be issued.

Signed-off-by: Roel Kluin <roel.kluin@...il.com>
Acked-by: David Brownell <dbrownell@...rs.sourceforge.net>
---
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
index 269a55e..b143e8c 100644
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -779,7 +779,8 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
 
 			/* Read trailing bytes */
 			limit = loops_per_jiffy << 1;
-			while ((read(drv_data) == 0) && limit--);
+			while ((read(drv_data) == 0) && --limit)
+				cpu_relax();
 
 			if (limit == 0)
 				dev_err(&drv_data->pdev->dev,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ