Skip to content

Commit 31834aa

Browse files
Yang Yingliangrafaeljw
authored andcommitted
ACPI: pfr_update: Fix return value check in pfru_write()
In case of error, memremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: 0db89fa ("ACPI: Introduce Platform Firmware Runtime Update device driver") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Yang Yingliang <[email protected]> Acked-by: Chen Yu <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 53e8558 commit 31834aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/acpi/pfr_update.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,8 @@ static ssize_t pfru_write(struct file *file, const char __user *buf,
460460
/* map the communication buffer */
461461
phy_addr = (phys_addr_t)((buf_info.addr_hi << 32) | buf_info.addr_lo);
462462
buf_ptr = memremap(phy_addr, buf_info.buf_size, MEMREMAP_WB);
463-
if (IS_ERR(buf_ptr))
464-
return PTR_ERR(buf_ptr);
463+
if (!buf_ptr)
464+
return -ENOMEM;
465465

466466
if (!copy_from_iter_full(buf_ptr, len, &iter)) {
467467
ret = -EINVAL;

0 commit comments

Comments
 (0)