mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peng Wu <wupeng58@huawei.com>
To: <jwerner@chromium.org>, <jrosenth@chromium.org>,
	<gregkh@linuxfoundation.org>, <groeck@chromium.org>
Cc: <linux-kernel@vger.kernel.org>, <liwei391@huawei.com>,
	Peng Wu <wupeng58@huawei.com>
Subject: [PATCH -next] firmware: google: fix a NULL vs IS_ERR() check in cbmem_entry_probe()
Date: Tue, 15 Nov 2022 09:11:38 +0000	[thread overview]
Message-ID: <20221115091138.51614-1-wupeng58@huawei.com> (raw)

The devm_memremap() function returns error pointers on error,
it doesn't return NULL.

Fixes: 19d54020883c ("firmware: google: Implement cbmem in sysfs driver")
Signed-off-by: Peng Wu <wupeng58@huawei.com>
---
 drivers/firmware/google/cbmem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/google/cbmem.c b/drivers/firmware/google/cbmem.c
index 685f3070ce9d..88e587ba1e0d 100644
--- a/drivers/firmware/google/cbmem.c
+++ b/drivers/firmware/google/cbmem.c
@@ -106,8 +106,8 @@ static int cbmem_entry_probe(struct coreboot_device *dev)
 	entry->mem_file_buf = devm_memremap(&dev->dev, dev->cbmem_entry.address,
 					    dev->cbmem_entry.entry_size,
 					    MEMREMAP_WB);
-	if (!entry->mem_file_buf)
-		return -ENOMEM;
+	if (IS_ERR(entry->mem_file_buf))
+		return PTR_ERR(entry->mem_file_buf);
 
 	entry->size = dev->cbmem_entry.entry_size;
 
-- 
2.17.1


             reply	other threads:[~2022-11-15  9:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  9:11 Peng Wu [this message]
2022-11-15 13:52 ` Guenter Roeck
2022-11-15 17:01 ` Jack Rosenthal

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=20221115091138.51614-1-wupeng58@huawei.com \
    --to=wupeng58@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@chromium.org \
    --cc=jrosenth@chromium.org \
    --cc=jwerner@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liwei391@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®