* net: hns: set correct return value
@ 2017-10-29 14:35 Pan Bian
2017-10-30 8:17 ` Tobias Klauser
0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2017-10-29 14:35 UTC (permalink / raw)
To: Yisen Zhuang, Salil Mehta, David S. Miller, lipeng, Kejian Yan,
Lin Yun Sheng, Tobias Klauser, Arnd Bergmann
Cc: netdev, linux-kernel, Pan Bian
The function of_parse_phandle() returns a NULL pointer if it cannot
resolve a phandle property to a device_node pointer. In function
hns_nic_dev_probe(), its return value is passed to PTR_ERR to extract
the error code. However, in this case, the extracted error code will
always be zero, which is unexpected.
Signed-off-by: Pan Bian <bianpan2016@163.com>
---
drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 3652063..e771926 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -2369,8 +2369,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
priv->enet_ver = AE_VERSION_2;
ae_node = of_parse_phandle(dev->of_node, "ae-handle", 0);
- if (IS_ERR_OR_NULL(ae_node)) {
- ret = PTR_ERR(ae_node);
+ if (!ae_node) {
+ ret = -ENODEV;
dev_err(dev, "not find ae-handle\n");
goto out_read_prop_fail;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: net: hns: set correct return value
2017-10-29 14:35 net: hns: set correct return value Pan Bian
@ 2017-10-30 8:17 ` Tobias Klauser
0 siblings, 0 replies; 2+ messages in thread
From: Tobias Klauser @ 2017-10-30 8:17 UTC (permalink / raw)
To: Pan Bian
Cc: Yisen Zhuang, Salil Mehta, David S. Miller, lipeng, Kejian Yan,
Lin Yun Sheng, Arnd Bergmann, netdev, linux-kernel
On 2017-10-29 at 15:35:32 +0100, Pan Bian <bianpan2016@163.com> wrote:
> The function of_parse_phandle() returns a NULL pointer if it cannot
> resolve a phandle property to a device_node pointer. In function
> hns_nic_dev_probe(), its return value is passed to PTR_ERR to extract
> the error code. However, in this case, the extracted error code will
> always be zero, which is unexpected.
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
The subject is missing a [PATCH] prefix which causes the patch e.g. to
not show up on patchwork [1]. Care to resend with the proper subject?
[1] https://patchwork.ozlabs.org/project/netdev/list/
Care to resend with the proper subject?
For the patch itself:
Reviewed-by: Tobias Klauser <tklauser@distanz.ch>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-30 8:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-29 14:35 net: hns: set correct return value Pan Bian
2017-10-30 8:17 ` Tobias Klauser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).