diff options
author | Matthew Wilcox <matthew@wil.cx> | 2008-05-01 04:35:04 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-01 08:04:01 -0700 |
commit | 0d34aa4d5a3e5d141bb4d07ed5d4bf02d4d4998a (patch) | |
tree | efabc24eae243a3f082c2c3cc9f912936e5efd3a /drivers/spi/spi_s3c24xx.c | |
parent | 8eeb12e5a2486ab958fa27ec97e71dabf234b73b (diff) | |
download | kernel_samsung_crespo-0d34aa4d5a3e5d141bb4d07ed5d4bf02d4d4998a.zip kernel_samsung_crespo-0d34aa4d5a3e5d141bb4d07ed5d4bf02d4d4998a.tar.gz kernel_samsung_crespo-0d34aa4d5a3e5d141bb4d07ed5d4bf02d4d4998a.tar.bz2 |
spi_s3c24xx signedness fix
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@diku.dk>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi/spi_s3c24xx.c')
-rw-r--r-- | drivers/spi/spi_s3c24xx.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index 34bfb7d..0885cc3 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c @@ -125,10 +125,10 @@ static int s3c24xx_spi_setupxfer(struct spi_device *spi, /* 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; |