Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3957572pxj; Mon, 24 May 2021 19:49:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+GtXDdxBx5BuCIpjGWe2xJSwtlc3ZZiQgPvOA9YczIk2J+tHELkLihgn6oRRYJcZ09aYj X-Received: by 2002:a92:ccd1:: with SMTP id u17mr506876ilq.239.1621910985849; Mon, 24 May 2021 19:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621910985; cv=none; d=google.com; s=arc-20160816; b=HxEVksrsPinZD6pWOVg2K4jif8DaJHh4kPKrMEajsFZnUWRPlCaPXx63YiYdjb/AWh SdB62TZvf15qd6dqJ36mZzCuAeayPvC6ACoOHTg5PCxjTtXLxlwvdY4Mw04tg2hd2uzb MExu8ElWEEzkveDO/4VA1cOA60aE4O+X69zcMie2csOuWKTqhzLHAJE5DqBvp0xJnUwn Eu2ytAlvonL91RqOyNkUvqKa1vKN3BG5E0g0G+rjzbz0/bBXr6RcOFxPJTI51oO0BWXy EO8a4hNYyFqq829rjw88hK97lW8KU9hOVgDbQjxq065gkiBD/tXkB8eaiYAp4Si7nCob CZjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=gLVm2OdMrASyqFfhERmuAUHrKXSevdqqu69fcARQ+9M=; b=c+UGc7fUuGEVuMB1Ytn2KtlR2kZGrDpU+5yMQrEUz/jDurpqcyz/kUcTw/2/TdxBJQ zroW2V2MCWCrZFNIks1jlgk/g+LllffGpMHGl17YONWM05AdEXQK00RNgq8qpLwsCR/Q CUO1jo/pHoOvCZYGuh2WsLwmHzpKv3X9xndcHkRigZz4lVXbKYTSk++IS8IanckWlKpJ ZMHLwjFlTwEGPeZfXFzsVUtHPybGpCULKhhhp1M9ihRE3Ek1lwNyTKl1bUt15qRDWFNn PQ1gl5X1w23JAmGnffLZrvhAkSfoeLj6wB5C2E8i4ZNntuFqyQ8ocEJtl2iN1qgTnIdB 0kKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r20si14334832ioj.88.2021.05.24.19.49.32; Mon, 24 May 2021 19:49:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230228AbhEYCsU (ORCPT + 99 others); Mon, 24 May 2021 22:48:20 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:3991 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbhEYCsU (ORCPT ); Mon, 24 May 2021 22:48:20 -0400 Received: from dggems704-chm.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Fpz1n0snxzmVFM; Tue, 25 May 2021 10:44:29 +0800 (CST) Received: from dggpemm500009.china.huawei.com (7.185.36.225) by dggems704-chm.china.huawei.com (10.3.19.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 25 May 2021 10:46:49 +0800 Received: from [10.174.179.24] (10.174.179.24) by dggpemm500009.china.huawei.com (7.185.36.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 25 May 2021 10:46:48 +0800 Subject: Re: [PATCH -next] ACPI: LPSS: Replaced simple_strtol() with kstrtol() To: "Rafael J. Wysocki" References: <20210524120832.1580247-1-liushixin2@huawei.com> CC: "Rafael J. Wysocki" , Len Brown , "ACPI Devel Maling List" , Linux Kernel Mailing List From: Liu Shixin Message-ID: Date: Tue, 25 May 2021 10:46:47 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500009.china.huawei.com (7.185.36.225) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/5/24 22:33, Rafael J. Wysocki wrote: > On Mon, May 24, 2021 at 1:35 PM Liu Shixin 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 >> --- >> 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); >> >> -- > . >