Skip to content

Commit

Permalink
octeon_ep: ensure octep_get_link_status() successfully before octep_l…
Browse files Browse the repository at this point in the history
…ink_up()

[ Upstream commit 9d3ff71 ]

octep_get_link_status() can fail because send mbox message failed, then
octep_get_link_status() will return ret less than 0. Excute octep_link_up()
as long as ret is not equal to 0 in octep_open() now. That is not correct.

The value type of link.state is enum octep_ctrl_net_state. Positive value
represents up. Excute octep_link_up() when ret is bigger than 0.

Fixes: 862cd65 ("octeon_ep: Add driver framework and device initialization")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Ziyang Xuan authored and gregkh committed Nov 26, 2022
1 parent 4e740e8 commit 3564f48
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/marvell/octeon_ep/octep_main.c
Expand Up @@ -521,7 +521,7 @@ static int octep_open(struct net_device *netdev)
octep_oq_dbell_init(oct);

ret = octep_get_link_status(oct);
if (ret)
if (ret > 0)
octep_link_up(netdev);

return 0;
Expand Down

0 comments on commit 3564f48

Please sign in to comment.