Skip to content

Commit 3eb3c3e

Browse files
Wei Yongjungregkh
authored andcommitted
staging: mt7621-eth: fix return value check in mt7621_gsw_probe()
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(). Fixes: f079b64 ("staging: mt7621-eth: add gigabit switch driver (GSW)") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9d350d8 commit 3eb3c3e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/staging/mt7621-eth/gsw_mt7621.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ static int mt7621_gsw_probe(struct platform_device *pdev)
263263
return -ENOMEM;
264264

265265
gsw->base = devm_ioremap_resource(&pdev->dev, res);
266-
if (!gsw->base)
267-
return -EADDRNOTAVAIL;
266+
if (IS_ERR(gsw->base))
267+
return PTR_ERR(gsw->base);
268268

269269
gsw->dev = &pdev->dev;
270270
gsw->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);

0 commit comments

Comments
 (0)