diff options
author | Dongliang Mu <dzm91@hust.edu.cn> | 2022-10-09 10:23:05 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-10-22 14:21:40 +0300 |
commit | 90732f1769165dcf0778d723ad188f6441a930f5 (patch) | |
tree | 526dd1181d9b64c127fb6070f2b6e44d489672a8 /drivers/usb/cdns3 | |
parent | 27ef01e381c777521084724248c5736cd1cdda63 (diff) | |
download | linux-90732f1769165dcf0778d723ad188f6441a930f5.tar.xz |
usb: cdns3: adjust the partial logic of cdnsp_pci_remove
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 <dzm91@hust.edu.cn>
Acked-by: Pawel Laszczak <pawell@cadence.com>
Link: https://lore.kernel.org/r/20221009072305.1593707-1-dzm91@hust.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/cdns3')
-rw-r--r-- | drivers/usb/cdns3/cdnsp-pci.c | 8 |
1 files 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); } |