* [patch 2.6.25-git] spi_s3c24xx signedness fix
@ 2008-05-01 2:57 David Brownell
0 siblings, 0 replies; only message in thread
From: David Brownell @ 2008-05-01 2:57 UTC (permalink / raw)
To: Andrew Morton
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Ben Dooks
From: Matthew Wilcox <matthew-Ztpu424NOJ8@public.gmane.org>
On Fri, Apr 18, 2008 at 09:08:55PM +0200, Julia Lawall wrote:
> I found 63 occurrences of this problem with the following semantic match
> (http://www.emn.fr/x-info/coccinelle/):
>
> @@ unsigned int i; @@
>
> * i < 0
>
Since this one's always in the range 0-255, it could probably be made
signed, but it's just as easy to make it work unsigned.
Reported-by: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
Signed-off-by: Matthew Wilcox <willy-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
drivers/spi/spi_s3c24xx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- at91.orig/drivers/spi/spi_s3c24xx.c 2008-04-28 21:56:43.000000000 -0700
+++ at91/drivers/spi/spi_s3c24xx.c 2008-04-30 19:48:47.000000000 -0700
@@ -125,10 +125,10 @@ static int s3c24xx_spi_setupxfer(struct
/* is clk = pclk / (2 * (pre+1)), or is it
* clk = (pclk * 2) / ( pre + 1) */
- div = (div / 2) - 1;
+ div /= 2;
- if (div < 0)
- div = 1;
+ if (div > 0)
+ div -= 1;
if (div > 255)
div = 255;
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-05-01 2:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-01 2:57 [patch 2.6.25-git] spi_s3c24xx signedness fix David Brownell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).