Skip to contentSkip to conversation

net: hns: enet specifies a reference to dsaf

DISCUSSION Dan Carpenter 2 participants 4 messages Mar 16, 2016 – Mar 18, 2016 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello yankejian,

The patch 48189d6aaf1e: "net: hns: enet specifies a reference to dsaf" from Jan 20, 2016, leads to the following static checker warning:

drivers/net/ethernet/hisilicon/hns/hns_enet.c:1885 hns_nic_dev_probe()
warn: passing zero to 'PTR_ERR'

drivers/net/ethernet/hisilicon/hns/hns_enet.c
1882

  1883          priv->ae_node = (void *)of_parse_phandle(node, "ae-handle", 0);
                                        ^^^^^^^^^^^^^^^^

I don't think this ever returns ERR_PTRs.

  1884          if (IS_ERR_OR_NULL(priv->ae_node)) {
  1885                  ret = PTR_ERR(priv->ae_node);

This should just be ret = -EINVAL because if priv->ae_node is NULL it means we are returning success.

  1886                  dev_err(dev, "not find ae-handle\n");
  1887                  goto out_read_prop_fail;
  1888          }
  1889  

regards,
dan carpenter

#1 lore raw

Hello dan,

Thanks for pointing it out. i will fix it in next submit.

MBR, Kejian

Quoted 32 lines · Dan Carpenter

Hello yankejian,

The patch 48189d6aaf1e: "net: hns: enet specifies a reference to dsaf" from Jan 20, 2016, leads to the following static checker warning:

drivers/net/ethernet/hisilicon/hns/hns_enet.c:1885 hns_nic_dev_probe()
warn: passing zero to 'PTR_ERR'

drivers/net/ethernet/hisilicon/hns/hns_enet.c
1882

  1883          priv->ae_node = (void *)of_parse_phandle(node, "ae-handle", 0);
                                        ^^^^^^^^^^^^^^^^

I don't think this ever returns ERR_PTRs.

  1884          if (IS_ERR_OR_NULL(priv->ae_node)) {
  1885                  ret = PTR_ERR(priv->ae_node);

This should just be ret = -EINVAL because if priv->ae_node is NULL it means we are returning success.

  1886                  dev_err(dev, "not find ae-handle\n");
  1887                  goto out_read_prop_fail;
  1888          }
  1889  

regards,
dan carpenter

#2 lore raw
In reply to Dan Carpenter
Quoted 4 lines · Yankejian (Hackim Yim)

Hello dan,

Thanks for pointing it out. i will fix it in next submit.

It has already been merged. You have to send a second patch on top of the original one.

regards,
dan carpenter

#3 lore raw
In reply to Dan Carpenter
Quoted 7 lines · Dan Carpenter
Quoted 4 lines · Yankejian (Hackim Yim)

Hello dan,

Thanks for pointing it out. i will fix it in next submit.

It has already been merged. You have to send a second patch on top of the original one.

OK, thanks! i will send a patch to fix it.

thanks again

Quoted 5 lines

regards,
dan carpenter