drivers: acpi: apd: Check return value of acpi_dev_get_property
PATCH 1/1 drivers: acpi: apd: Check return value of acpi_dev_get_property
fch_misc_setup() uses acpi_dev_get_property() to read the value of "is-rv" passed in by BIOS in ACPI tables. However, not all BIOSes might pass in this property and hence it is important to first check the return value of acpi_dev_get_property() before referencing the object filled by it.
--- drivers/acpi/acpi_apd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/acpi_apd.c +2 -2
@@ -99,8 +99,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)if (ret <0 )return -ENOENT ; -acpi_dev_get_property (adev,"is-rv" ,ACPI_TYPE_INTEGER , &obj); - clk_data->is_rv = obj->integer.value; +if (!acpi_dev_get_property (adev,"is-rv" ,ACPI_TYPE_INTEGER , &obj)) + clk_data->is_rv = obj->integer.value;list_for_each_entry (rentry, &resource_list, node) { clk_data->base = devm_ioremap(&adev->dev, rentry->res->start,
Signature · 1 line
2.28.0.220.ged08abb693-goog
Rafael J. Wysocki
maintainerQuoted 18 lines · Furquan Shaikh
fch_misc_setup()usesacpi_dev_get_property()to read the value of "is-rv" passed in by BIOS in ACPI tables. However, not all BIOSes might pass in this property and hence it is important to first check the return value ofacpi_dev_get_property()before referencing the object filled by it.Signed-off-by Furquan Shaikh <[email protected]>--- drivers/acpi/acpi_apd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/acpi/acpi_apd.c +0
-0@@ -99,8 +99,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)if (ret <0 )
drivers/acpi/acpi_apd.c static int fch_misc_setup(struct apd_private_data *pdata)
Quoted 10 lines
drivers/acpi/acpi_apd.c +2
-3return -ENOENT ; -acpi_dev_get_property (adev,"is-rv" ,ACPI_TYPE_INTEGER , &obj); - clk_data->is_rv = obj->integer.value; +if (!acpi_dev_get_property (adev,"is-rv" ,ACPI_TYPE_INTEGER , &obj)) + clk_data->is_rv = obj->integer.value;list_for_each_entry (rentry, &resource_list, node) { clk_data->base = devm_ioremap(&adev->dev, rentry->res->start, --
Applied (with minor subject edits) as 5.9-rc material, thanks!