lkml.org 
[lkml]   [2020]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] drivers: acpi: apd: Check return value of acpi_dev_get_property
On Wed, Aug 19, 2020 at 7:17 PM Furquan Shaikh <furquan@google.com> wrote:
>
> `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.
>
> Signed-off-by: Furquan Shaikh <furquan@google.com>
> ---
> drivers/acpi/acpi_apd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
> index 4c348377a39d..806b8ce05624 100644
> --- a/drivers/acpi/acpi_apd.c
> +++ b/drivers/acpi/acpi_apd.c
> @@ -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,
> --

Applied (with minor subject edits) as 5.9-rc material, thanks!

\
 
 \ /
  Last update: 2020-08-21 20:29    [W:0.027 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site