diff options
author | Colin Ian King <colin.king@canonical.com> | 2017-08-17 12:01:07 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-17 20:06:07 +0300 |
commit | fd07a62d58c16b1fdd46f4099791c5bd242908c3 (patch) | |
tree | 4d0391fe6c983dc26b1eaff1b0561bbfba070d1d /drivers/net/ethernet/hisilicon | |
parent | 93345c06b74513c1e1c7933aef146e1d03420079 (diff) | |
download | linux-fd07a62d58c16b1fdd46f4099791c5bd242908c3.tar.xz |
net: hns3: ensure media_type is unitialized
Media type is only set if h->ae_algo->ops->get_media_type is called
so there is a possibility that media_type is uninitialized when it is
used a switch statement. Fix this by initializing media_type to
HNAE3_MEDIA_TYPE_UNKNOWN.
Detected by CoverityScan, CID#1452624("Uninitialized scalar variable")
Fixes: 496d03e960ae ("net: hns3: Add Ethtool support to HNS3 driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c index 0ad65e47c77e..53cab3ad4cda 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c @@ -304,7 +304,7 @@ static int hns3_get_link_ksettings(struct net_device *netdev, struct hnae3_handle *h = priv->ae_handle; u32 supported_caps; u32 advertised_caps; - u8 media_type; + u8 media_type = HNAE3_MEDIA_TYPE_UNKNOWN; u8 link_stat; u8 auto_neg; u8 duplex; |