From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16AC2C4707F for ; Tue, 25 May 2021 10:26:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED781611CD for ; Tue, 25 May 2021 10:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231470AbhEYK2C (ORCPT ); Tue, 25 May 2021 06:28:02 -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-Google-Smtp-Source: ABdhPJwDUCJ73zzJQWjIxFwCFNHIgoHmKKukJ6QLJUNXs6dbWTgSSsxLvIU514HxZUzO3g80pxLuMbMz3cz3zVyKJfI= 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?