From: Arnd Bergmann <arnd@arndb.de>
To: "David S. Miller" <davem@davemloft.net>,
Philippe Reynes <tremyfr@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] net: mii: report 0 for unknown lp_advertising
Date: Tue, 8 Nov 2016 14:31:38 +0100 [thread overview]
Message-ID: <20161108133232.1571441-1-arnd@arndb.de> (raw)
The newly introduced mii_ethtool_get_link_ksettings function sets
lp_advertising to an uninitialized value when BMCR_ANENABLE is not
set:
drivers/net/mii.c: In function 'mii_ethtool_get_link_ksettings':
drivers/net/mii.c:224:2: error: 'lp_advertising' may be used uninitialized in this function [-Werror=maybe-uninitialized]
As documented in include/uapi/linux/ethtool.h, the value is
expected to be zero when we don't know it, so let's initialize
it to that.
Fixes: bc8ee596afe8 ("net: mii: add generic function to support ksetting support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/mii.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/mii.c b/drivers/net/mii.c
index 0443546fc427..6d953c53eed6 100644
--- a/drivers/net/mii.c
+++ b/drivers/net/mii.c
@@ -213,6 +213,8 @@ int mii_ethtool_get_link_ksettings(struct mii_if_info *mii,
SPEED_100 : SPEED_10));
cmd->base.duplex = (bmcr & BMCR_FULLDPLX) ?
DUPLEX_FULL : DUPLEX_HALF;
+
+ lp_advertising = 0;
}
mii->full_duplex = cmd->base.duplex;
--
2.9.0
next reply other threads:[~2016-11-08 13:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-08 13:31 Arnd Bergmann [this message]
2016-11-08 13:37 ` [PATCH] net: mii: report 0 for unknown lp_advertising Arnd Bergmann
2016-11-10 1:27 ` 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=20161108133232.1571441-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tremyfr@gmail.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;
as well as URLs for NNTP newsgroup(s).