提交 8f4c38f7 编写于 作者: Y Yang Yingliang 提交者: David S. Miller

net: sparx5: fix return value check in sparx5_create_targets()

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

Fixes: 3cfa11ba ("net: sparx5: add the basic sparx5 driver")
Reported-by: NHulk Robot <hulkci@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f00af5cc
...@@ -236,10 +236,10 @@ static int sparx5_create_targets(struct sparx5 *sparx5) ...@@ -236,10 +236,10 @@ static int sparx5_create_targets(struct sparx5 *sparx5)
iores[idx]->start, iores[idx]->start,
iores[idx]->end - iores[idx]->start iores[idx]->end - iores[idx]->start
+ 1); + 1);
if (IS_ERR(iomem[idx])) { if (!iomem[idx]) {
dev_err(sparx5->dev, "Unable to get switch registers: %s\n", dev_err(sparx5->dev, "Unable to get switch registers: %s\n",
iores[idx]->name); iores[idx]->name);
return PTR_ERR(iomem[idx]); return -ENOMEM;
} }
begin[idx] = iomem[idx] - sparx5_main_iomap[range_id[idx]].offset; begin[idx] = iomem[idx] - sparx5_main_iomap[range_id[idx]].offset;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册