All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sesterhenn <snakebyte@gmx.de>
To: Dave Jones <davej@redhat.com>
Cc: Richard Knutsson <ricknu-0@student.ltu.se>,
	linux-kernel@vger.kernel.org, drzeus-sdhci@drzeus.cx
Subject: Re: [Patch] Signedness issue in drivers/net/phy/phy_device.c
Date: Sun, 20 Aug 2006 22:39:08 +0200	[thread overview]
Message-ID: <1156106348.5150.1.camel@alice> (raw)
In-Reply-To: <20060820191643.GA2608@redhat.com>

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 (ricknu-0@student.ltu.se) 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 <snakebyte@gmx.de>

--- 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



  reply	other threads:[~2006-08-20 20:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-19 17:33 [Patch] Signedness issue in drivers/net/phy/phy_device.c Eric Sesterhenn
2006-08-20  4:12 ` Richard Knutsson
2006-08-20 18:36   ` Eric Sesterhenn / Snakebyte
2006-08-20 19:16     ` Dave Jones
2006-08-20 20:39       ` Eric Sesterhenn [this message]
2006-08-20 20:26     ` Richard Knutsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1156106348.5150.1.camel@alice \
    --to=snakebyte@gmx.de \
    --cc=davej@redhat.com \
    --cc=drzeus-sdhci@drzeus.cx \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ricknu-0@student.ltu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.