diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2022-01-07 04:35:16 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-01-11 16:35:41 +0100 |
commit | 2cea3ec5b0099d0e9dd6752aa86e08bce38d6b32 (patch) | |
tree | bcc7205e53999ec0890217c3af61ecc87cda71bb | |
parent | Merge tag 'acpi-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ra... (diff) | |
download | linux-2cea3ec5b0099d0e9dd6752aa86e08bce38d6b32.tar.xz linux-2cea3ec5b0099d0e9dd6752aa86e08bce38d6b32.zip |
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: 3f4ba94e3615 ("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>
-rw-r--r-- | drivers/acpi/acpi_apd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c index 6e02448d15d9..9db6409ecb47 100644 --- a/drivers/acpi/acpi_apd.c +++ b/drivers/acpi/acpi_apd.c @@ -95,6 +95,8 @@ static int fch_misc_setup(struct apd_private_data *pdata) resource_size(rentry->res)); break; } + if (!clk_data->base) + return -ENOMEM; acpi_dev_free_resource_list(&resource_list); |