Commit 9d3ff713 authored by Ziyang Xuan's avatar Ziyang Xuan Committed by David S. Miller

octeon_ep: ensure octep_get_link_status() successfully before octep_link_up()

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: 862cd659 ("octeon_ep: Add driver framework and device initialization")
Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 298b83e1
......@@ -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;
......
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