Re: [PATCH -next] ACPI: LPSS: Replaced simple_strtol() with kstrtol()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2021/5/24 22:33, Rafael J. Wysocki wrote:
> On Mon, May 24, 2021 at 1:35 PM Liu Shixin <liushixin2@xxxxxxxxxx> 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@xxxxxxxxxx>
>> ---
>>  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?
The variables status and shared_host are valid only when the uid is not zero(default to zero).
If uid_str is NULL or kstrtol() failed or uid is assigned to zero, we can skip these operations.
>>         lpss_deassert_reset(pdata);
>>
>> --
> .
>




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux