Skip to content

Commit

Permalink
n64cart: fix return value check in n64cart_probe()
Browse files Browse the repository at this point in the history
In case of error, the function devm_platform_ioremap_resource()
returns ERR_PTR() and never returns NULL. The NULL test in the
return value check should be replaced with IS_ERR().

Fixes: d9b2a2b ("block: Add n64 cart driver")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Yang Yingliang <[email protected]>
Reviewed-by: Chaitanya Kulkarni <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Yang Yingliang authored and axboe committed Sep 9, 2021
1 parent 7f2a6a6 commit 221e836
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/block/n64cart.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ static int __init n64cart_probe(struct platform_device *pdev)
}

reg_base = devm_platform_ioremap_resource(pdev, 0);
if (!reg_base)
return -EINVAL;
if (IS_ERR(reg_base))
return PTR_ERR(reg_base);

disk = blk_alloc_disk(NUMA_NO_NODE);
if (!disk)
Expand Down

0 comments on commit 221e836

Please sign in to comment.