Skip to content

Commit

Permalink
firmware: google: fix a NULL vs IS_ERR() check in cbmem_entry_probe()
Browse files Browse the repository at this point in the history
The devm_memremap() function returns error pointers on error,
it doesn't return NULL.

Fixes: 19d5402 ("firmware: google: Implement cbmem in sysfs driver")
Signed-off-by: Peng Wu <wupeng58@huawei.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Link: https://lore.kernel.org/r/20221115091138.51614-1-wupeng58@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peng Wu authored and gregkh committed Nov 23, 2022
1 parent ab76079 commit fa1ba41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/firmware/google/cbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit fa1ba41

Please sign in to comment.