diff options
author | Kejian Yan <yankejian@huawei.com> | 2016-03-24 07:08:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-24 14:33:07 -0400 |
commit | daa8cfd9da728b9e35c49311b23127a8859a5f3b (patch) | |
tree | 4f611b7b9d89c71ee3b7ee527453fd9089c8ad73 | |
parent | 4b34aa412c1213912608742b4d016f616b23d9e2 (diff) |
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: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns/hns_enet.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 66d1652ffbed..687204b780b0 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c | |||
@@ -1814,7 +1814,7 @@ static int hns_nic_try_get_ae(struct net_device *ndev) | |||
1814 | h = hnae_get_handle(&priv->netdev->dev, | 1814 | h = hnae_get_handle(&priv->netdev->dev, |
1815 | priv->ae_node, priv->port_id, NULL); | 1815 | priv->ae_node, priv->port_id, NULL); |
1816 | if (IS_ERR_OR_NULL(h)) { | 1816 | if (IS_ERR_OR_NULL(h)) { |
1817 | ret = PTR_ERR(h); | 1817 | ret = -ENODEV; |
1818 | dev_dbg(priv->dev, "has not handle, register notifier!\n"); | 1818 | dev_dbg(priv->dev, "has not handle, register notifier!\n"); |
1819 | goto out; | 1819 | goto out; |
1820 | } | 1820 | } |