From: Matt Carlson Date: Thu, 14 Oct 2010 10:37:44 +0000 (+0000) Subject: tg3: Report invalid link from tg3_get_settings() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=64c2218266996b562a8e940a95a887fc432daced;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git tg3: Report invalid link from tg3_get_settings() Currently the tg3 driver leaves the speed and duplex fields uninitialized in tg3_get_settings() if the device is not up. This can lead to some strange deductions in certain versions of ethtool. When the device is up and the link is down, the driver reports SPEED_INVALID and DUPLEX_INVALID for these fields. This patch makes the presentation consistent by returning SPEED_INVALID and DUPLEX_INVALID when the device has not been brought up as well. Signed-off-by: Matt Carlson Reviewed-by: Michael Chan Signed-off-by: David S. Miller --- diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 17ca0a37c9e7..5d30e67ffe69 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -9807,6 +9807,9 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) if (netif_running(dev)) { cmd->speed = tp->link_config.active_speed; cmd->duplex = tp->link_config.active_duplex; + } else { + cmd->speed = SPEED_INVALID; + cmd->duplex = DUPLEX_INVALID; } cmd->phy_address = tp->phy_addr; cmd->transceiver = XCVR_INTERNAL;