linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Furquan Shaikh <furquan@google.com>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>, Aaron Durbin <adurbin@google.com>,
	"Agrawal, Akshu" <akshu.agrawal@amd.com>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers: acpi: apd: Check return value of acpi_dev_get_property
Date: Fri, 21 Aug 2020 20:28:41 +0200	[thread overview]
Message-ID: <CAJZ5v0h3vFLyY9AXYFvcJD3agYk7RFCyzkWefDk_9bvCE09RNg@mail.gmail.com> (raw)
In-Reply-To: <20200819171656.2650926-1-furquan@google.com>

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!

      reply	other threads:[~2020-08-21 18:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19 17:16 [PATCH] drivers: acpi: apd: Check return value of acpi_dev_get_property Furquan Shaikh
2020-08-21 18:28 ` Rafael J. Wysocki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJZ5v0h3vFLyY9AXYFvcJD3agYk7RFCyzkWefDk_9bvCE09RNg@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=adurbin@google.com \
    --cc=akshu.agrawal@amd.com \
    --cc=furquan@google.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).