Commit 9db85f33 authored by Salil's avatar Salil Committed by David S. Miller

net: hns3: Fixes the static checker error warning in hns3_get_link_ksettings()

This patch fixes the static check error warning in hns3_get_link_ksettings()
function by re-arranging the code.

Fixes: 496d03e9 ("net: hns3: Add Ethtool support to HNS3 Driver")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d36d36ce
......@@ -313,7 +313,7 @@ static int hns3_get_link_ksettings(struct net_device *netdev,
if (!h->ae_algo || !h->ae_algo->ops)
return -EOPNOTSUPP;
/* 1.auto_neg&speed&duplex from cmd */
/* 1.auto_neg & speed & duplex from cmd */
if (h->ae_algo->ops->get_ksettings_an_result) {
h->ae_algo->ops->get_ksettings_an_result(h, &auto_neg,
&speed, &duplex);
......@@ -329,31 +329,41 @@ static int hns3_get_link_ksettings(struct net_device *netdev,
}
/* 2.media_type get from bios parameter block */
if (h->ae_algo->ops->get_media_type)
if (h->ae_algo->ops->get_media_type) {
h->ae_algo->ops->get_media_type(h, &media_type);
switch (media_type) {
case HNAE3_MEDIA_TYPE_FIBER:
cmd->base.port = PORT_FIBRE;
supported_caps = HNS3_LM_FIBRE_BIT | HNS3_LM_AUTONEG_BIT |
HNS3_LM_PAUSE_BIT | HNS3_LM_1000BASET_FULL_BIT;
supported_caps = HNS3_LM_FIBRE_BIT |
HNS3_LM_AUTONEG_BIT |
HNS3_LM_PAUSE_BIT |
HNS3_LM_1000BASET_FULL_BIT;
advertised_caps = supported_caps;
break;
case HNAE3_MEDIA_TYPE_COPPER:
cmd->base.port = PORT_TP;
supported_caps = HNS3_LM_TP_BIT | HNS3_LM_AUTONEG_BIT |
HNS3_LM_PAUSE_BIT | HNS3_LM_1000BASET_FULL_BIT |
HNS3_LM_100BASET_FULL_BIT | HNS3_LM_100BASET_HALF_BIT |
HNS3_LM_10BASET_FULL_BIT | HNS3_LM_10BASET_HALF_BIT;
supported_caps = HNS3_LM_TP_BIT |
HNS3_LM_AUTONEG_BIT |
HNS3_LM_PAUSE_BIT |
HNS3_LM_1000BASET_FULL_BIT |
HNS3_LM_100BASET_FULL_BIT |
HNS3_LM_100BASET_HALF_BIT |
HNS3_LM_10BASET_FULL_BIT |
HNS3_LM_10BASET_HALF_BIT;
advertised_caps = supported_caps;
break;
case HNAE3_MEDIA_TYPE_BACKPLANE:
cmd->base.port = PORT_NONE;
supported_caps = HNS3_LM_BACKPLANE_BIT | HNS3_LM_PAUSE_BIT |
HNS3_LM_AUTONEG_BIT | HNS3_LM_1000BASET_FULL_BIT |
HNS3_LM_100BASET_FULL_BIT | HNS3_LM_100BASET_HALF_BIT |
HNS3_LM_10BASET_FULL_BIT | HNS3_LM_10BASET_HALF_BIT;
supported_caps = HNS3_LM_BACKPLANE_BIT |
HNS3_LM_PAUSE_BIT |
HNS3_LM_AUTONEG_BIT |
HNS3_LM_1000BASET_FULL_BIT |
HNS3_LM_100BASET_FULL_BIT |
HNS3_LM_100BASET_HALF_BIT |
HNS3_LM_10BASET_FULL_BIT |
HNS3_LM_10BASET_HALF_BIT;
advertised_caps = supported_caps;
break;
......@@ -368,6 +378,7 @@ static int hns3_get_link_ksettings(struct net_device *netdev,
/* now, map driver link modes to ethtool link modes */
hns3_driv_to_eth_caps(supported_caps, cmd, false);
hns3_driv_to_eth_caps(advertised_caps, cmd, true);
}
/* 3.mdix_ctrl&mdix get from phy reg */
if (h->ae_algo->ops->get_mdix_mode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment