public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] IB/hns: Fix return value check in hns_roce_get_cfg()
@ 2016-08-06  1:01 Wei Yongjun
       [not found] ` <1470445284-28970-1-git-send-email-weiyj.lk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Wei Yongjun @ 2016-08-06  1:01 UTC (permalink / raw)
  To: Lijun Ou, Wei Hu(Xavier), Doug Ledford, Sean Hefty,
	Hal Rosenstock
  Cc: Wei Yongjun, linux-rdma-u79uwXL29TY76Z2rM5mHXA

In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <weiyj.lk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hns/hns_roce_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 5b42ec8..6ead671 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -715,8 +715,8 @@ static int hns_roce_get_cfg(struct hns_roce_dev *hr_dev)
 
 	res = platform_get_resource(hr_dev->pdev, IORESOURCE_MEM, 0);
 	hr_dev->reg_base = devm_ioremap_resource(dev, res);
-	if (!hr_dev->reg_base)
-		return -ENOMEM;
+	if (IS_ERR(hr_dev->reg_base))
+		return PTR_ERR(hr_dev->reg_base);
 
 	for (i = 0; i < HNS_ROCE_MAX_PORTS; i++) {
 		net_node = of_parse_phandle(np, "eth-handle", i);



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-08-24  1:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-06  1:01 [PATCH -next] IB/hns: Fix return value check in hns_roce_get_cfg() Wei Yongjun
     [not found] ` <1470445284-28970-1-git-send-email-weiyj.lk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-08-07  5:31   ` Leon Romanovsky
     [not found]     ` <20160807053115.GQ27667-2ukJVAZIZ/Y@public.gmane.org>
2016-08-07 12:19       ` Wei Yongjun
     [not found]         ` <087f4381-d830-fc57-ea5d-c516a1b160b5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-08-07 13:14           ` Leon Romanovsky
     [not found]             ` <20160807131419.GS27667-2ukJVAZIZ/Y@public.gmane.org>
2016-08-11 10:43               ` Wei Hu (Xavier)
     [not found]                 ` <57AC56D4.3050401-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-08-22 18:15                   ` Doug Ledford
     [not found]                     ` <c27a3c5f-9604-546a-5ac7-e70613d93d50-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-08-23  1:56                       ` Wei Hu (Xavier)
     [not found]                         ` <57BBAD65.6000108-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-08-23 10:59                           ` Leon Romanovsky
     [not found]                             ` <20160823105926.GG15065-2ukJVAZIZ/Y@public.gmane.org>
2016-08-24  1:22                               ` Wei Hu (Xavier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox