Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3433518ybb; Mon, 6 Apr 2020 08:51:41 -0700 (PDT) X-Google-Smtp-Source: APiQypIfHtdwzFeIDqT0o9qwIISSJIFq6/NsdhBtFarP1ZglmE6VhpFHRT/tLn0+FZl3U29kEA42 X-Received: by 2002:a05:6830:239b:: with SMTP id l27mr18298575ots.278.1586188300985; Mon, 06 Apr 2020 08:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586188300; cv=none; d=google.com; s=arc-20160816; b=bnXiahZx8QkD6rFCgFZWAeWvfDg/Mu4FXDpBdFx/aNu928AR/GVV1vXHBM7T4juOlI oP3n7WOkDZr9PZuTAtU6ndXJ71BpkM9UfOaLajofS66yfsyVURpNk3/tMxLqLcTh4u8i yZfkuV3DJLrKaFMYH/EdLPk3XyxIi9ty1M1wTIHP25Sq0fZRm14MSlYoqgL8afz9HIQ4 zHo1VOn+wHL4hNesjxGhKQ/rDL+Ag+q+ZUkWEUkCHJaEm9KAdqsbmBwtGiGzGBtfmAZL dIY32YcvhlgaM10ZUqmQXU4EhBZ4Tjn2g9pPEb3qhnIAJK5HrZLt8lp678BHICHpX+mp xrjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=EuQiUSplMfkXGKc+DFWcE6rPPkUfLZmRb5p5kzTH8xI=; b=HxDhmXv8eVMZUlu3ko4Y+OQpgSHb+tf6bZfPue80HYtuM7bb1SN/1dNlUGqwbNyOno TenB1IL/ExMRNBuWE620VpvsJ1YG5OLr70hhKMA2GdfpclLAXRDn7g8hBdrfWPASR139 J3/OaldauEqQBBo8Ivw7iJb13GZC0lxGYjNOjMp/2+wBLCbQDwwIpx66P3tpzCDEL8Gn mjbZv64GBHe6ph2/mIeMcpC+R5bdV3gnkIH92qsEGYeEEq2XyJ5PMDiVyNZi2djVmriP xXcaUZSkmoquTlR5M/WnJC3qIRW2XH9nYK19RHUOQ6q06UdoUs8+EcNwt2VWdxqq+2l/ RnIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r187si7719349oig.168.2020.04.06.08.51.28; Mon, 06 Apr 2020 08:51:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729079AbgDFPtt (ORCPT + 99 others); Mon, 6 Apr 2020 11:49:49 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:44641 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728945AbgDFPts (ORCPT ); Mon, 6 Apr 2020 11:49:48 -0400 Received: from 185.80.35.16 (185.80.35.16) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.341) id 52034e87f0ed0a75; Mon, 6 Apr 2020 17:49:46 +0200 From: "Rafael J. Wysocki" To: Linux ACPI Cc: Linux PM , LKML , "Rafael J. Wysocki" , Dan Carpenter Subject: [PATCH] ACPI: EC: Fix up fast path check in acpi_ec_add() Date: Mon, 06 Apr 2020 17:49:45 +0200 Message-ID: <1708495.96b3J6AjSg@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki The fast path check in acpi_ec_add() is not incorrect, because in fact acpi_device_hid(device) can be equal to ACPI_ECDT_HID only if boot_ec is not NULL, but it may confuse static checkers, so change it to explicitly check boot_ec upfront and use the slow path if that pointer is NULL. Link: https://lore.kernel.org/linux-acpi/20200406144217.GA68494@mwanda/ Fixes: 3d9b8dd8320d ("ACPI: EC: Use fast path in acpi_ec_add() for DSDT boot EC") Reported-by: Dan Carpenter Signed-off-by: Rafael J. Wysocki --- drivers/acpi/ec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: linux-pm/drivers/acpi/ec.c =================================================================== --- linux-pm.orig/drivers/acpi/ec.c +++ linux-pm/drivers/acpi/ec.c @@ -1589,8 +1589,8 @@ static int acpi_ec_add(struct acpi_devic strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); strcpy(acpi_device_class(device), ACPI_EC_CLASS); - if ((boot_ec && boot_ec->handle == device->handle) || - !strcmp(acpi_device_hid(device), ACPI_ECDT_HID)) { + if (boot_ec && (boot_ec->handle == device->handle || + !strcmp(acpi_device_hid(device), ACPI_ECDT_HID))) { /* Fast path: this device corresponds to the boot EC. */ ec = boot_ec; } else {