Skip to contentSkip to conversation

n64cart: fix return value check in n64cart_probe()

PATCH Applied Yang Yingliang 3 participants 3 messages Sep 9, 2021 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 n64cart: fix return value check in n64cart_probe()

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")
---
 drivers/block/n64cart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/n64cart.c +2 -2
index c84be0028f63..26798da661bd 100644
@@ -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)
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Yang Yingliang

External email: Use caution opening links or attachments

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")

Looks good.

maintainer Applied
#2 lore raw
In reply to Yang Yingliang
Quoted 3 lines · Yang Yingliang

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().

Applied, thanks.

Signature · 1 line
Jens Axboe