n64cart: fix return value check in n64cart_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 9 Sep 2021 09:06:08 +0000 (17:06 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 9 Sep 2021 20:24:02 +0000 (14:24 -0600)
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: d9b2a2bbbb4d ("block: Add n64 cart driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Link: https://lore.kernel.org/r/20210909090608.2989716-1-yangyingliang@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/n64cart.c

index c84be00..26798da 100644 (file)
@@ -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)