Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3133336rwb; Sat, 8 Oct 2022 22:45:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4WGf/GqN3nrbF3t/nuwAIQFacOUYUSH2ZnzKKqIhVXNXHzTqeFN5WjxZZGjs+XB/zvur5u X-Received: by 2002:a17:903:1c3:b0:180:a0e6:f80d with SMTP id e3-20020a17090301c300b00180a0e6f80dmr7691600plh.151.1665294338197; Sat, 08 Oct 2022 22:45:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665294338; cv=none; d=google.com; s=arc-20160816; b=CW7bBA5Vw9UFIAjy9oLRMBPxGgGS7htTJf1f67pTk7E3IhBghw2CkVOvrvgK4MdNCq cMBwD5h7llEP7O1QM3fBImS+Vn2+GU6KBSmVY3H7368USmiStAKTU5FvwdzU8B8xVe0t b8CAbqiBBXZgsLmJ5cOft7qCWh4QcKuj4r5S4pfj1b8ABZODX4+CjvpgB8nAol/1HRFV 2drwmfnxw2vrEfm9sOJ4B77PJPtREjxWMgcEnt7NYEKlbBqOdWgWa0SKzJcj+Y6eoktW SSQyVMyoYoHd372f1v1Awyf2h9M0KKtn3LxHGl0u/5H6jpgihb4U+B1C18FYUuxPanEg hyOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=gy4CvseC+8Hz5Yy/DEl1plEIPzXV2LMS+wf44Z93Uks=; b=ZR49/a2SPQ/5MS/3/PLGRtdui9UDhAXBcQif6MwbB/hHh2x8C2xVKHlEVYZu/zRVsO PwOh+NdGHbvuvVsmCgpAsm+pF6cOEiCUpCVM7bFS3eCTQY3KRdLE8WWk7Ku0pun9Anss 8fmXaE2qYOZvd7lAYicoUIfUjkIxJYmOeETM4Ilpz1Om7G25QD0QYwydpeyCZ1kS7LOe FYb+AUM40VoXPK4mLR26Bb1kN9KIEmV54edAnPlT/s5SFdvg4znKgOVy3N7nni1oedq4 lQjCnWHaZl3zCVlAWMWpVd6CwQ+jSFLZqv6X5d4EBoKjCgproKw9gpS99sy7YcNh5Z/R p2DQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o6-20020a6548c6000000b004468fac0319si4554173pgs.212.2022.10.08.22.45.27; Sat, 08 Oct 2022 22:45:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229747AbiJIFev (ORCPT + 99 others); Sun, 9 Oct 2022 01:34:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbiJIFes (ORCPT ); Sun, 9 Oct 2022 01:34:48 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 721C06580; Sat, 8 Oct 2022 22:34:45 -0700 (PDT) Received: from localhost.localdomain ([172.16.0.254]) (user=dzm91@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 2995YOn1011882-2995YOn4011882 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 9 Oct 2022 13:34:29 +0800 From: Dongliang Mu To: Pawel Laszczak , Greg Kroah-Hartman Cc: Dongliang Mu , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: cdns3: adjust the partial logic of cdnsp_pci_remove Date: Sun, 9 Oct 2022 13:32:45 +0800 Message-Id: <20221009053245.154922-1-dzm91@hust.edu.cn> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: dzm91@hust.edu.cn X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dongliang Mu In cdnsp_pci_remove, if pci_is_enabled returns true, it will call cdns_remove; else it will call kfree. Then both control flow goes to pci_dev_put. Adjust this logic by modifying it to an if else. Signed-off-by: Dongliang Mu --- drivers/usb/cdns3/cdnsp-pci.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/usb/cdns3/cdnsp-pci.c b/drivers/usb/cdns3/cdnsp-pci.c index fe8a114c586c..efd54ed918b9 100644 --- a/drivers/usb/cdns3/cdnsp-pci.c +++ b/drivers/usb/cdns3/cdnsp-pci.c @@ -192,14 +192,12 @@ static void cdnsp_pci_remove(struct pci_dev *pdev) if (pci_dev_run_wake(pdev)) pm_runtime_get_noresume(&pdev->dev); - if (!pci_is_enabled(func)) { + if (pci_is_enabled(func)) { + cdns_remove(cdnsp); + } else { kfree(cdnsp); - goto pci_put; } - cdns_remove(cdnsp); - -pci_put: pci_dev_put(func); } -- 2.35.1