Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4014895pxj; Tue, 8 Jun 2021 04:34:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNHRP0USZ5FEvCT+FJnhDuLhBRfRlCG3HTQvNrPm1rGO06G4hN8KkJ/BUHyZMp/DuTrph7 X-Received: by 2002:aa7:cf0f:: with SMTP id a15mr22577953edy.313.1623152055287; Tue, 08 Jun 2021 04:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623152055; cv=none; d=google.com; s=arc-20160816; b=s2+Q6rUTH6HqND/HPMltkdkTR2t4FZsUPq2sz01qNI7C+bel0NLmIjVH1Nw9k7yT3J qztAPlj2xnrz9O32oLHfrr8d9TsX1o4bA9ImpHPpPRmVAHVZht25DPZuyCJYI/b+CADe S3pslOS5FOpgALi7OQHpeSb82dSfdretS8ztc/uIp5Zq3VZ6VJ2/42P5y2kN/74lU7rX KcxMQVhWU1xFHtQmg1NIsRd6WfXLgukZYkeMUrNrXk+OXIq9wHz1cyBguackGVBJFHkO BYNSBUfXPV6G7Yb98W+tQMZxiJnP/YM+clfVKrqCuo80c0VLVlC3Ap2qKIGwDmZLLCVo ZDjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=2EYKoTZsUlQj7/Efb/4n9VgmYml6dMuUuTGXgPKXtlQ=; b=nPAgS9MDC+CmUPSQJAymvGLIZRZe91StLQv6NC5Ry1U4PX6DtWf71y/Y5RzOvyVvTP Rc/i2pPh1sDTKqKbcqeV8pYVV6A4myNZjhRme+L/3mXo5LSnXC9vXh9LsJ1vGHv8UxZm +46OIljZ9BBKcfInjJmLHa+pw6eJymx/EvIid3dCXK9Dk+BwB0C1L5F2I5jKnV8P+8VH yHBFcNJjlI2b4viABTJIxAYnL3i+jlqWbsDRVCGriUkU/xgxxgM86ryzhRPz08BgR1i/ Etmdb327SzfgPXPDxlJ3TYNVe52fzpOf1ztIgeCNZ4AtMkPvkR0coGXbCY3otAaxGVAX dmfw== 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 u1si14029072edp.527.2021.06.08.04.33.51; Tue, 08 Jun 2021 04:34:15 -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 S231791AbhFHLck (ORCPT + 99 others); Tue, 8 Jun 2021 07:32:40 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3471 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231768AbhFHLcj (ORCPT ); Tue, 8 Jun 2021 07:32:39 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Fznz20fLnz6tv8; Tue, 8 Jun 2021 19:27:42 +0800 (CST) Received: from dggemi762-chm.china.huawei.com (10.1.198.148) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Tue, 8 Jun 2021 19:30:45 +0800 Received: from [10.174.178.208] (10.174.178.208) by dggemi762-chm.china.huawei.com (10.1.198.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Tue, 8 Jun 2021 19:30:38 +0800 Subject: Re: [PATCH -next] i2c: Fix missing pci_disable_device() on error in ali1535_setup() To: Jean Delvare CC: , References: <1623036068-30668-1-git-send-email-zou_wei@huawei.com> <20210608114636.65512e28@endymion> From: Samuel Zou Message-ID: Date: Tue, 8 Jun 2021 19:30:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20210608114636.65512e28@endymion> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.208] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggemi762-chm.china.huawei.com (10.1.198.148) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jean, Thanks for your review and detailed explanation. On 2021/6/8 17:46, Jean Delvare wrote: > Hi Wei, > > On Mon, 07 Jun 2021 11:21:08 +0800, Zou Wei wrote: >> Fix the missing pci_disable_device() before return >> from ali1535_setup() in the error handling case. >> >> Reported-by: Hulk Robot >> Signed-off-by: Zou Wei >> --- >> drivers/i2c/busses/i2c-ali1535.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c >> index fb93152..bdbaf79 100644 >> --- a/drivers/i2c/busses/i2c-ali1535.c >> +++ b/drivers/i2c/busses/i2c-ali1535.c >> @@ -206,6 +206,7 @@ static int ali1535_setup(struct pci_dev *dev) >> exit_free: >> release_region(ali1535_smba, ALI1535_SMB_IOSIZE); >> exit: >> + pci_disable_device(dev); >> return retval; >> } >> > > We don't actually want to disable the PCI device. Maybe it was already > enabled before the driver was loaded, and maybe the BIOS needs the > device when the system is being shut down. You'll notice that we do not > call pci_disable_device(dev) in ali1535_remove(), so there's no reason > to do it in the error path. > > As a matter of fact the i2c-i801 driver, which is used on the same kind > of hardware, has the following note in its remove function: > > /* > * do not call pci_disable_device(dev) since it can cause hard hangs on > * some systems during power-off (eg. Fujitsu-Siemens Lifebook E8010) > */ > > So this is a nack from me, sorry. >