All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yongjun <weiyongjun1@huawei.com>
To: Hulk Robot <hulkci@huawei.com>, Jens Axboe <axboe@kernel.dk>,
	"Lauri Kasanen" <cand@gmx.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>, <linux-block@vger.kernel.org>
Subject: [PATCH -next] n64: fix return value check in n64cart_probe()
Date: Tue, 23 Feb 2021 14:01:04 +0000	[thread overview]
Message-ID: <20210223140104.1743541-1-weiyongjun1@huawei.com> (raw)

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: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/block/n64cart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/n64cart.c b/drivers/block/n64cart.c
index 47bdf324e962..84a0f8d0be29 100644
--- a/drivers/block/n64cart.c
+++ b/drivers/block/n64cart.c
@@ -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 ERR_PTR(reg_base);
 
 	disk = alloc_disk(0);
 	if (!disk)


             reply	other threads:[~2021-02-23 13:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 14:01 Wei Yongjun [this message]
2021-02-23 14:56 ` [PATCH -next] n64: fix return value check in n64cart_probe() Lauri Kasanen
2021-02-23 19:32 ` Chaitanya Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210223140104.1743541-1-weiyongjun1@huawei.com \
    --to=weiyongjun1@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=cand@gmx.com \
    --cc=hulkci@huawei.com \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.