Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: mii: report 0 for unknown lp_advertising

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Arnd Bergmann and committed by
David S. Miller
dc0b2c9c 6c27f99d

+2
+2
drivers/net/mii.c
··· 213 213 SPEED_100 : SPEED_10)); 214 214 cmd->base.duplex = (bmcr & BMCR_FULLDPLX) ? 215 215 DUPLEX_FULL : DUPLEX_HALF; 216 + 217 + lp_advertising = 0; 216 218 } 217 219 218 220 mii->full_duplex = cmd->base.duplex;