Skip to content

Commit

Permalink
staging: mt7621-eth: fix return value check in mt7621_gsw_probe()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wei Yongjun authored and Greg Kroah-Hartman committed Mar 22, 2018
1 parent 9d350d8 commit 3eb3c3e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/mt7621-eth/gsw_mt7621.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ static int mt7621_gsw_probe(struct platform_device *pdev)
return -ENOMEM;

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

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

0 comments on commit 3eb3c3e

Please sign in to comment.