Skip to content

Commit dc0b2c9

Browse files
arndbdavem330
authored andcommitted
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: bc8ee59 ("net: mii: add generic function to support ksetting support") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6c27f99 commit dc0b2c9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/mii.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ int mii_ethtool_get_link_ksettings(struct mii_if_info *mii,
213213
SPEED_100 : SPEED_10));
214214
cmd->base.duplex = (bmcr & BMCR_FULLDPLX) ?
215215
DUPLEX_FULL : DUPLEX_HALF;
216+
217+
lp_advertising = 0;
216218
}
217219

218220
mii->full_duplex = cmd->base.duplex;

0 commit comments

Comments
 (0)