Skip to content

Commit 2cea3ec

Browse files
JiangJiasrafaeljw
authored andcommitted
ACPI: APD: Check for NULL pointer after calling devm_ioremap()
Because devres_alloc() may fail, devm_ioremap() may return NULL. Then, 'clk_data->base' will be assigned to clkdev->data->base in platform_device_register_data(). The PTR_ERR_OR_ZERO() check on clk_data does not cover 'base', so it is better to add an explicit check against NULL after updating it. Fixes: 3f4ba94 ("ACPI: APD: Add AMD misc clock handler support") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> [ rjw: Changelog rewrite ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent bca2175 commit 2cea3ec

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/acpi/acpi_apd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)
9595
resource_size(rentry->res));
9696
break;
9797
}
98+
if (!clk_data->base)
99+
return -ENOMEM;
98100

99101
acpi_dev_free_resource_list(&resource_list);
100102

0 commit comments

Comments
 (0)