Re: [Patch] Signedness issue in drivers/net/phy/phy_device.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2006-08-20 at 15:16 -0400, Dave Jones wrote:
> On Sun, Aug 20, 2006 at 08:36:00PM +0200, Eric Sesterhenn / Snakebyte wrote:
>  > * Richard Knutsson ([email protected]) wrote:
>  > > Eric Sesterhenn wrote:
>  > hi,
>  > 
>  > > Would it not be preferable to use a 's32' instead of an 'int'? After 
>  > > all, it seem 'val' needs to be 32 bits.
>  > 
>  > not sure, but wouldnt this collide with platforms where an int is 64
>  > Bits?
> 
> None of the 64-bit Linux ports use ILP64.

Here is an updated patch.

while checking gcc 4.1 -Wextra warnings, I stumbled across the following
two warnings:

drivers/net/phy/phy_device.c:528: warning: comparison of unsigned expression < 0 is always false
drivers/net/phy/phy_device.c:546: warning: comparison of unsigned expression < 0 is always false

Since phy_read() returns an integer and can return negative values, as proposed
by Richard Knutsson this patch changes val to s32. Currently it is an u32, so the < 0 check
always fails.

Signed-off-by: Eric Sesterhenn <[email protected]>

--- linux-2.6.18-rc4/drivers/net/phy/phy_device.c.orig	2006-08-20 22:05:26.000000000 +0200
+++ linux-2.6.18-rc4/drivers/net/phy/phy_device.c	2006-08-20 22:05:42.000000000 +0200
@@ -513,7 +513,7 @@ EXPORT_SYMBOL(genphy_read_status);
 
 static int genphy_config_init(struct phy_device *phydev)
 {
-	u32 val;
+	s32 val;
 	u32 features;
 
 	/* For now, I'll claim that the generic driver supports


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux