[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210524120832.1580247-1-liushixin2@huawei.com>
Date: Mon, 24 May 2021 20:08:32 +0800
From: Liu Shixin <liushixin2@...wei.com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>
CC: <linux-acpi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Liu Shixin <liushixin2@...wei.com>
Subject: [PATCH -next] ACPI: LPSS: Replaced simple_strtol() with kstrtol()
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@...wei.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));
+ }
lpss_deassert_reset(pdata);
--
2.18.0.huawei.25
Powered by blists - more mailing lists