Skip to content

Commit

Permalink
staging: mt7621-eth: fix return value check in mtk_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: e3cbf47 ("staging: mt7621-eth: add the drivers core files")
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 2a5f03b commit 960526d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/mt7621-eth/mtk_eth_soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2077,8 +2077,8 @@ static int mtk_probe(struct platform_device *pdev)
return -ENOMEM;

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

spin_lock_init(&eth->page_lock);

Expand Down

0 comments on commit 960526d

Please sign in to comment.