netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: akpm@linux-foundation.org
Cc: David.Choi@Micrel.Com, netdev@vger.kernel.org,
	Charles.Li@Micrel.Com, horms@verge.net.au
Subject: Re: [PATCH v4 2.6.35-rc3] drivers/net: ks8842 driver
Date: Mon, 19 Jul 2010 15:26:21 -0700 (PDT)	[thread overview]
Message-ID: <20100719.152621.93431422.davem@davemloft.net> (raw)
In-Reply-To: <20100719151725.fc11b40d.akpm@linux-foundation.org>

From: Andrew Morton <akpm@linux-foundation.org>
Date: Mon, 19 Jul 2010 15:17:25 -0700

> On Tue, 13 Jul 2010 10:14:34 -0700 (PDT)
> David Miller <davem@davemloft.net> wrote:
> 
>> From: David J. Choi <david.choi@micrel.com>
>> Date: Tue, 13 Jul 2010 10:09:19 -0700
>> Subject: [PATCH] drivers/net: Add Micrel KS8841/42 support to ks8842 driver
>> 
>> Body of the explanation:
>>    -support 16bit and 32bit bus width.
>>    -add device reset for ks8842/8841 Micrel device.
>>    -set 100Mbps as a default for Micrel device.
>>    -set MAC address in both MAC/Switch layer with different sequence for Micrel
>>     device, as mentioned in data sheet.
>>    -use private data to set options both 16/32bit bus width and Micrel device/
>>     Timberdale(FPGA).
>>    -update Kconfig in order to put more information about ks8842 device.
> 
> gcc says
> 
> drivers/net/ks8842.c: In function 'ks8842_handle_rx':
> drivers/net/ks8842.c:428: warning: 'status' may be used uninitialized in this function
> 
> and I think I agree with it..

I'll fix this, as below.

David Choi, I'm quite upset, this shows that you did not test the
16-bit code paths (the whole _point_ of this change) at all.  You
didn't even validate the build for new warnings.

--------------------
ks8842: Fix ks8842_tx_frame() for 16bit case.

As reported by Andrew:

drivers/net/ks8842.c: In function 'ks8842_handle_rx':
drivers/net/ks8842.c:428: warning: 'status' may be used uninitialized in this function

Just use the 32-bit status for all reads, and delete the useless
cast to 'int' when reading a u16 into 'len'.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/ks8842.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ks8842.c b/drivers/net/ks8842.c
index ee69dea..634dad1 100644
--- a/drivers/net/ks8842.c
+++ b/drivers/net/ks8842.c
@@ -424,16 +424,14 @@ static int ks8842_tx_frame(struct sk_buff *skb, struct net_device *netdev)
 static void ks8842_rx_frame(struct net_device *netdev,
 	struct ks8842_adapter *adapter)
 {
-	u16 status16;
 	u32 status;
 	int len;
 
 	if (adapter->conf_flags & KS884X_16BIT) {
-		status16 = ks8842_read16(adapter, 17, REG_QMU_DATA_LO);
-		len  = (int)ks8842_read16(adapter, 17, REG_QMU_DATA_HI);
-		len &= 0xffff;
+		status = ks8842_read16(adapter, 17, REG_QMU_DATA_LO);
+		len = ks8842_read16(adapter, 17, REG_QMU_DATA_HI);
 		netdev_dbg(netdev, "%s - rx_data: status: %x\n",
-			   __func__, status16);
+			   __func__, status);
 	} else {
 		status = ks8842_read32(adapter, 17, REG_QMU_DATA_LO);
 		len = (status >> 16) & 0x7ff;
-- 
1.7.1.1


  reply	other threads:[~2010-07-19 22:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-13 15:42 [PATCH v4 2.6.35-rc3] drivers/net: ks8842 driver Choi, David
2010-07-13 17:14 ` David Miller
2010-07-19 22:17   ` Andrew Morton
2010-07-19 22:26     ` David Miller [this message]
2010-07-19 22:45       ` Andrew Morton

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=20100719.152621.93431422.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=Charles.Li@Micrel.Com \
    --cc=David.Choi@Micrel.Com \
    --cc=akpm@linux-foundation.org \
    --cc=horms@verge.net.au \
    --cc=netdev@vger.kernel.org \
    /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 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).