Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3239775rwb; Sun, 9 Oct 2022 01:15:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XeBmz92mCa+QlhndwTze96Q+wjkq6ZGvCXzHjjdyC0H90rLeHx6cky4pRvVHeA58JwWuN X-Received: by 2002:a17:90a:1b0a:b0:203:6731:4c98 with SMTP id q10-20020a17090a1b0a00b0020367314c98mr24617133pjq.10.1665303315861; Sun, 09 Oct 2022 01:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665303315; cv=none; d=google.com; s=arc-20160816; b=PhetvHGmyrCIpjuvp1GaAjBNJ1pKEx64U64GYPXjCQF7Ekuk94VaXtzL1I+cwVgv4B OH48/CuCUdBWvNbnxxWRxApEoq/GmJHIgRHYZavbsVlZTCkUdHrdbaMVfa+DQKNYBz3d 4Oz7RcjXyRNET5iD3Id0aYvoXjHUEHCkJIp1CyRFBnr5XzXZLLF34WwPuzir2liAJ/ke Z0Jyr6nEWRdqlfp+2hT+sHZiVSfZ5ot7FgBmihNJXNBUSfJ5yKDbhyGOHf5lcslF2CVt 21jFZ/AhU2ptv5clGeQFMYckI5ejxUAkThPSJOw311FyCUCCBXjs0CwKyaiMnI9xb31F nz7w== 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=lMOzXW5jFZgaucE2vtZy3aywa6/iUSdcHNbk1Acq3Bw=; b=g6/7MdbkBWaKeaVuU7EYHm45hX5JdjmNglrAD/eCzybkdoCoPTF1Xx2sfzjnshYRaf UbLFbf1Nbp5Vu//waG7acM6pcziuQHEG859d2UDVMSyRkAg6FEBhvFaGp1Qb+8gLV0UE SwGpaVXgJEcYHjbVZLkbnp0OyduNWfxXOoVwbdSjquqQSnLSonFGb5/DLKGRBGWwrexn qVU/h3/D2stJ5LLMlIPHjcFZYpZGd/XlanqbNR0bD6N48Gu34ReJrvD8MmYXlDuGnbpI bQxY0Kb2/QCadAEnU9bHg4F20KdqX+4rzEEzJ5Vt5cpp57DH/CXwLP6mZU5lelmt5pl9 5iiw== 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 t21-20020a63f355000000b004583940d4d3si8118659pgj.552.2022.10.09.01.15.04; Sun, 09 Oct 2022 01:15:15 -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 S229913AbiJIHYZ (ORCPT + 99 others); Sun, 9 Oct 2022 03:24:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbiJIHYX (ORCPT ); Sun, 9 Oct 2022 03:24:23 -0400 Received: from hust.edu.cn (unknown [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B1241F622; Sun, 9 Oct 2022 00:24:22 -0700 (PDT) Received: from localhost.localdomain ([222.20.126.44]) (user=dzm91@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 2997NQwF022725-2997NQwI022725 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sun, 9 Oct 2022 15:23:31 +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 15:23:05 +0800 Message-Id: <20221009072305.1593707-1-dzm91@hust.edu.cn> X-Mailer: git-send-email 2.25.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 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.25.1