netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev <netdev@vger.kernel.org>, Nicolas Pitre <nico@fluxnic.net>,
	Andrew Lunn <andrew@lunn.ch>
Subject: [PATCH v3 net-next 3/7] drivers: net: smc911x: Work around set but unused status
Date: Tue, 10 Nov 2020 04:02:44 +0100	[thread overview]
Message-ID: <20201110030248.1480413-4-andrew@lunn.ch> (raw)
In-Reply-To: <20201110030248.1480413-1-andrew@lunn.ch>

drivers/net/ethernet/smsc/smc911x.c: In function ‘smc911x_phy_interrupt’:
drivers/net/ethernet/smsc/smc911x.c:976:6: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
  976 |  int status;

A comment indicates the status needs to be read from the PHY,
otherwise bad things happen. But due to the macro magic, it is hard to
perform the read without assigning it to a variable. So add
_always_unused attribute to status to tell the compiler we don't
expect to use the value.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/ethernet/smsc/smc911x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
index 01069dfaf75c..8f748a0c057e 100644
--- a/drivers/net/ethernet/smsc/smc911x.c
+++ b/drivers/net/ethernet/smsc/smc911x.c
@@ -879,7 +879,7 @@ static void smc911x_phy_configure(struct work_struct *work)
 	int phyaddr = lp->mii.phy_id;
 	int my_phy_caps; /* My PHY capabilities */
 	int my_ad_caps; /* My Advertised capabilities */
-	int status;
+	int status __always_unused;
 	unsigned long flags;
 
 	DBG(SMC_DEBUG_FUNC, dev, "--> %s()\n", __func__);
@@ -973,7 +973,7 @@ static void smc911x_phy_interrupt(struct net_device *dev)
 {
 	struct smc911x_local *lp = netdev_priv(dev);
 	int phyaddr = lp->mii.phy_id;
-	int status;
+	int status __always_unused;
 
 	DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__);
 
-- 
2.29.2


  parent reply	other threads:[~2020-11-10  3:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10  3:02 [PATCH v3 net-next 0/7] smsc W=1 warning fixes Andrew Lunn
2020-11-10  3:02 ` [PATCH v3 net-next 1/7] drivers: net: smc91x: Fix set but unused W=1 warning Andrew Lunn
2020-11-10  3:02 ` [PATCH v3 net-next 2/7] drivers: net: smc91x: Fix missing kerneldoc reported by W=1 Andrew Lunn
2020-11-10  3:02 ` Andrew Lunn [this message]
2020-11-10  3:02 ` [PATCH v3 net-next 4/7] drivers: net: smc911x: Fix set but unused status because of DBG macro Andrew Lunn
2020-11-10  3:02 ` [PATCH v3 net-next 5/7] drivers: net: smc911x: Fix passing wrong number of parameters to DBG() macro Andrew Lunn
2020-11-10  3:02 ` [PATCH v3 net-next 6/7] drivers: net: smc911x: Fix cast from pointer to integer of different size Andrew Lunn
2020-11-10  3:02 ` [PATCH v3 net-next 7/7] drivers: net: smsc: Add COMPILE_TEST support Andrew Lunn
2020-11-12 22:51 ` [PATCH v3 net-next 0/7] smsc W=1 warning fixes Jakub Kicinski

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=20201110030248.1480413-4-andrew@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=kuba@kernel.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).