Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 0db89fa243e5 ("ACPI: Introduce Platform Firmware Runtime Update device driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Yang Yingliang and committed by
Rafael J. Wysocki
31834aaa 53e85588

+2 -2
+2 -2
drivers/acpi/pfr_update.c
··· 460 460 /* map the communication buffer */ 461 461 phy_addr = (phys_addr_t)((buf_info.addr_hi << 32) | buf_info.addr_lo); 462 462 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; 465 465 466 466 if (!copy_from_iter_full(buf_ptr, len, &iter)) { 467 467 ret = -EINVAL;