From: Arnd Bergmann <arnd@arndb.de>
To: Iyappan Subramanian <isubramanian@apm.com>,
Keyur Chudgar <kchudgar@apm.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
"David S. Miller" <davem@davemloft.net>,
Tanmay Inamdar <tinamdar@apm.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] net: xgene: fix maybe-uninitialized variable
Date: Tue, 2 Aug 2016 12:23:29 +0200 [thread overview]
Message-ID: <20160802102348.81986-1-arnd@arndb.de> (raw)
Building with -Wmaybe-uninitialized shows a potential use of
an uninitialized variable:
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c: In function 'xgene_enet_phy_connect':
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c:802:23: warning: 'phy_dev' may be used uninitialized in this function [-Wmaybe-uninitialized]
Although the compiler correctly identified this based on the function,
the current code is still safe as long dev->of_node is non-NULL
for the case of CONFIG_ACPI=n, which is currently the case.
The warning is now disabled by default, but still appears when
building with W=1, and other build test tools should be able to
detect it as well. Adding an #else clause here makes the code
more robust and makes it clear to the compiler that this cannot
happen.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 8089a96f601b ("drivers: net: xgene: Add backward compatibility")
---
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 7714b7d4026a..98779fe2d558 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -792,6 +792,8 @@ int xgene_enet_phy_connect(struct net_device *ndev)
netdev_err(ndev, "Could not connect to PHY\n");
return -ENODEV;
}
+#else
+ return -ENODEV;
#endif
}
--
2.9.0
next reply other threads:[~2016-08-02 10:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-02 10:23 Arnd Bergmann [this message]
2016-08-03 18:52 ` David Miller
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=20160802102348.81986-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=isubramanian@apm.com \
--cc=kchudgar@apm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tinamdar@apm.com \
/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
all inboxes | Powered by JetHome®