linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Liu Shixin <liushixin2@huawei.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] ACPI: LPSS: Replaced simple_strtol() with kstrtol()
Date: Mon, 24 May 2021 16:33:46 +0200	[thread overview]
Message-ID: <CAJZ5v0gZYupB2w4oU1QGvE5aohcyPXk=BJVRvSrApGzp=sXkMQ@mail.gmail.com> (raw)
In-Reply-To: <20210524120832.1580247-1-liushixin2@huawei.com>

On Mon, May 24, 2021 at 1:35 PM Liu Shixin <liushixin2@huawei.com> wrote:
>
> The simple_strtol() function is deprecated in some situation since
> it does not check for the range overflow. Use kstrtol() instead.
>
> Signed-off-by: Liu Shixin <liushixin2@huawei.com>
> ---
>  drivers/acpi/acpi_lpss.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
> index ca742f16a507..1b46e00cad3a 100644
> --- a/drivers/acpi/acpi_lpss.c
> +++ b/drivers/acpi/acpi_lpss.c
> @@ -186,13 +186,12 @@ static void byt_i2c_setup(struct lpss_private_data *pdata)
>         long uid = 0;
>
>         /* Expected to always be true, but better safe then sorry */
> -       if (uid_str)
> -               uid = simple_strtol(uid_str, NULL, 10);
> -
> -       /* Detect I2C bus shared with PUNIT and ignore its d3 status */
> -       status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
> -       if (ACPI_SUCCESS(status) && shared_host && uid)
> -               pmc_atom_d3_mask &= ~(BIT_LPSS2_F1_I2C1 << (uid - 1));
> +       if (uid_str && !kstrtol(uid_str, 10, &uid)) {
> +               /* Detect I2C bus shared with PUNIT and ignore its d3 status */
> +               status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
> +               if (ACPI_SUCCESS(status) && shared_host && uid)
> +                       pmc_atom_d3_mask &= ~(BIT_LPSS2_F1_I2C1 << (uid - 1));
> +       }

This is not a simple replacement.

Why are you making the other changes?

>
>         lpss_deassert_reset(pdata);
>
> --

  reply	other threads:[~2021-05-24 14:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24 12:08 [PATCH -next] ACPI: LPSS: Replaced simple_strtol() with kstrtol() Liu Shixin
2021-05-24 14:33 ` Rafael J. Wysocki [this message]
2021-05-25  2:46   ` Liu Shixin
2021-05-25 10:26     ` Rafael J. Wysocki

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='CAJZ5v0gZYupB2w4oU1QGvE5aohcyPXk=BJVRvSrApGzp=sXkMQ@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liushixin2@huawei.com \
    --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).