Commit daa8cfd9 authored by Kejian Yan's avatar Kejian Yan Committed by David S. Miller

net: hns: fix warning of passing zero to 'PTR_ERR'

There is a misuse of PTR as shown below:

	ae_node = (void *)of_parse_phandle(dev->of_node,
					   "ae-handle",
					   0);
	if (IS_ERR_OR_NULL(ae_node)) {
		ret = PTR_ERR(ae_node);
		dev_err(dev, "not find ae-handle\n");
		goto out_read_prop_fail;
	}

if the ae_node is NULL, PTR_ERR(ae_node) means it returns success. And the
return value should be -ENODEV.
Signed-off-by: default avatarKejian Yan <yankejian@huawei.com>
Signed-off-by: default avatarYisen Zhuang <Yisen.Zhuang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4b34aa41
......@@ -1814,7 +1814,7 @@ static int hns_nic_try_get_ae(struct net_device *ndev)
h = hnae_get_handle(&priv->netdev->dev,
priv->ae_node, priv->port_id, NULL);
if (IS_ERR_OR_NULL(h)) {
ret = PTR_ERR(h);
ret = -ENODEV;
dev_dbg(priv->dev, "has not handle, register notifier!\n");
goto out;
}
......
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