From: David Laight <David.Laight@ACULAB.COM>
To: 'Jakub Kicinski' <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>
Cc: netdev <netdev@vger.kernel.org>, Nicolas Pitre <nico@fluxnic.net>,
"Lee Jones" <lee.jones@linaro.org>
Subject: RE: [PATCH net-next v2 1/7] drivers: net: smc91x: Fix set but unused W=1 warning
Date: Fri, 6 Nov 2020 08:48:47 +0000 [thread overview]
Message-ID: <749857e283f04d3b8f84f603fa065cd6@AcuMS.aculab.com> (raw)
In-Reply-To: <20201105143742.047959ed@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
From: Jakub Kicinski
> Sent: 05 November 2020 22:38
> On Wed, 4 Nov 2020 16:48:52 +0100 Andrew Lunn wrote:
> > drivers/net/ethernet/smsc/smc91x.c:706:51: warning: variable ‘pkt_len’ set but not used [-Wunused-
> but-set-variable]
> > 706 | unsigned int saved_packet, packet_no, tx_status, pkt_len;
> >
> > Add a new macro for getting fields out of the header, which only gets
> > the status, not the length which in this case is not needed.
> >
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
>
> Sorry I missed something on v1
>
> > +#define SMC_GET_PKT_HDR_STATUS(lp, status) \
> > + do { \
> > + if (SMC_32BIT(lp)) { \
> > + unsigned int __val = SMC_inl(ioaddr, DATA_REG(lp)); \
> > + (status) = __val & 0xffff; \
> > + } else { \
> > + (status) = SMC_inw(ioaddr, DATA_REG(lp)); \
> > + } \
> > + } while (0)
>
> This is the original/full macro:
>
> #define SMC_GET_PKT_HDR(lp, status, length) \
> do { \
> if (SMC_32BIT(lp)) { \
> unsigned int __val = SMC_inl(ioaddr, DATA_REG(lp)); \
> (status) = __val & 0xffff; \
> (length) = __val >> 16; \
> } else { \
> (status) = SMC_inw(ioaddr, DATA_REG(lp)); \
> (length) = SMC_inw(ioaddr, DATA_REG(lp)); \
> } \
> } while (0)
>
> Note that it reads the same address twice in the else branch.
>
> I'm 90% sure we can't remove the read here either so best treat it
> like the ones in patch 3, right?
One of the two SMC_inw() needs to use 'ioaddr + 2'.
Probably the one for (length).
The code may also be buggy on BE systems.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2020-11-06 8:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 15:48 [PATCH net-next v2 0/7] smsc W=1 warning fixes Andrew Lunn
2020-11-04 15:48 ` [PATCH net-next v2 1/7] drivers: net: smc91x: Fix set but unused W=1 warning Andrew Lunn
2020-11-05 22:37 ` Jakub Kicinski
2020-11-06 8:48 ` David Laight [this message]
2020-11-06 17:42 ` Jakub Kicinski
2020-11-04 15:48 ` [PATCH net-next v2 2/7] drivers: net: smc91x: Fix missing kerneldoc reported by W=1 Andrew Lunn
2020-11-04 15:48 ` [PATCH net-next v2 3/7] drivers: net: smc911x: Work around set but unused status Andrew Lunn
2020-11-04 15:48 ` [PATCH net-next v2 4/7] drivers: net: smc911x: Fix set but unused status because of DBG macro Andrew Lunn
2020-11-04 15:48 ` [PATCH net-next v2 5/7] drivers: net: smc911x: Fix passing wrong number of parameters to DBG() macro Andrew Lunn
2020-11-04 15:48 ` [PATCH net-next v2 6/7] drivers: net: smc911x: Fix cast from pointer to integer of different size Andrew Lunn
2020-11-05 22:47 ` Jakub Kicinski
2020-11-06 8:44 ` David Laight
2020-11-06 15:05 ` Nicolas Pitre
2020-11-06 15:29 ` David Laight
2020-11-06 15:47 ` Nicolas Pitre
2020-11-04 15:48 ` [PATCH net-next v2 7/7] drivers: net: smsc: Add COMPILE_TEST support Andrew Lunn
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=749857e283f04d3b8f84f603fa065cd6@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=andrew@lunn.ch \
--cc=kuba@kernel.org \
--cc=lee.jones@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=nico@fluxnic.net \
/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).