i2c/i2c-pasemi.c: Fix unsigned return type
authorJulia Lawall <julia@diku.dk>
Sun, 5 Sep 2010 09:00:22 +0000 (09:00 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 13 Oct 2010 05:19:04 +0000 (16:19 +1100)
The function has an unsigned return type, but returns a negative constant
to indicate an error condition.  The result of calling the function is
always stored in a variable of type (signed) int, and thus unsigned can be
dropped from the return type.

A sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@exists@
identifier f;
constant C;
@@

 unsigned f(...)
 { <+...
*  return -C;
 ...+> }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
drivers/i2c/busses/i2c-pasemi.c

index 4174101660c91430782620ce0df8895c1d3c734a..837b8c1aa02a494ef92899c46ccaf67cb709f9c1 100644 (file)
@@ -88,7 +88,7 @@ static void pasemi_smb_clear(struct pasemi_smbus *smbus)
        reg_write(smbus, REG_SMSTA, status);
 }
 
-static unsigned int pasemi_smb_waitready(struct pasemi_smbus *smbus)
+static int pasemi_smb_waitready(struct pasemi_smbus *smbus)
 {
        int timeout = 10;
        unsigned int status;