Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4245244pxj; Tue, 25 May 2021 03:43:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSl8Che8Eo3mKkScu5w0k5Otn+P3uu8WjU4x0bwyUgQv11XuBNTcL7BZZwjE/cPWFMGSGm X-Received: by 2002:a17:906:b10e:: with SMTP id u14mr27458970ejy.546.1621939418611; Tue, 25 May 2021 03:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621939418; cv=none; d=google.com; s=arc-20160816; b=xj/XvgsrF4/WM64cFASVro86NjDHEgCBzmSV228RdvnCUwTcMSZYMq+G23e205ssuM BDPOK6rbJ4GWLtNWNwO7tBvJn5MaS9pQsSmfR7q58uX5nWGD0x61LM5AbzPuoAqua7Ws oGNTdrmQcG/D723EolLG9gDtP1RLAVtPvn2ByRR5TWOGoiV6XYtI2ThSCsxQQifXrMWm 8N9Tb0W9iYxirHp6ZlNfjomNozMR4uO7zAr6mZ9gNM59F5Y8vwNxve12wUVaoET820rW k424L7WHSTnluMuR9tFWT2grPKxGFhk1KXWv0jMN5BTkprZRICr1OH+jZrMN8opNFpb8 T89A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=6Oe6ef/YqF0WwCiE/tghboe752yi2MANOadQ5vxRieQ=; b=Vc3DQaChO4nG1y41hjhU8vJdrvNpjXWw6iNGcpLYydONyBT/HADDwn8nF9q59zU8nT CIWy9ZGcSxwpEkgOQCOhdKBBnA/w/8fXN1Ewl2h0Lhaj9m3BHppv5B+5Xe3kgl2lxGnX STGLtMiDZGrvQno9fyPluEjMDh6vFG22oQVKhIgYG5RWJKY/opexcwKAtrgqzvESNtsu 0iXg2REgown13AKcXvqT2WAXm/jBSKMpE4Kq/7QUDG95h3/e0rfm/3/ZLbTVy/rhyTTE ovuWe0cMJl+5BUKvEdtScZYgca+svmOK9NCtQHPkCxmfWPMK7N4GgzgUqxpS3pxYgJW1 s9Hg== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z15si16293367ejj.367.2021.05.25.03.43.14; Tue, 25 May 2021 03:43:38 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231641AbhEYK2B (ORCPT + 99 others); Tue, 25 May 2021 06:28:01 -0400 Received: from mail-oi1-f181.google.com ([209.85.167.181]:33662 "EHLO mail-oi1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231355AbhEYK1x (ORCPT ); Tue, 25 May 2021 06:27:53 -0400 Received: by mail-oi1-f181.google.com with SMTP id b25so29872027oic.0; Tue, 25 May 2021 03:26:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6Oe6ef/YqF0WwCiE/tghboe752yi2MANOadQ5vxRieQ=; b=WIojTnBIuypkYjaHkoJKnV0O3l/Dn7UiDnzMH7cjK5MXh6fFJxF0vof+1Z47hHwMGB o/0rxuayckn2ETPEvCf7kfFPw+5LVk9YZBPeMcB/Ar1q+0WbhLt5zl9Rt3dBkKUcc4HW Yy3kY+0SHWIh1DAaE8uDaqYbJZ+Jmi6rKnOU0683dIMhKe5c6tYNbUh004+rjUfvk9G8 4IlfyBOwMOQV/NODTAMO00C1PlSdHSWdzHKigOkwZN8c4TMhRc1wYB2G+AJ4R410gwR0 rX+8WRb7HNEbBvkjR1A3rLx32+N6JIvpfwxND9yLi+72PAKGzgY4EDpeHjofRdBWlHye zdqw== X-Gm-Message-State: AOAM531JgTlDYWeQmrG1BL7j0T07aX9C+4tAshJIH4er46xl4+ZkQh9G 9ov1CBeeRTunDDjEHIHbSTzFogNUm7bVC283z8Hwa/jK X-Received: by 2002:aca:1910:: with SMTP id l16mr13033204oii.69.1621938383625; Tue, 25 May 2021 03:26:23 -0700 (PDT) MIME-Version: 1.0 References: <20210524120832.1580247-1-liushixin2@huawei.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Tue, 25 May 2021 12:26:11 +0200 Message-ID: Subject: Re: [PATCH -next] ACPI: LPSS: Replaced simple_strtol() with kstrtol() To: Liu Shixin Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Len Brown , ACPI Devel Maling List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 25, 2021 at 4:46 AM Liu Shixin wrote: > > > > 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. So why don't you write this in the changelog of the patch?