diff mbox series

usb: cdns3: adjust the partial logic of cdnsp_pci_remove

Message ID 20221009072305.1593707-1-dzm91@hust.edu.cn
State New
Headers show
Series usb: cdns3: adjust the partial logic of cdnsp_pci_remove | expand

Commit Message

Dongliang Mu Oct. 9, 2022, 7:23 a.m. UTC
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>
---
 drivers/usb/cdns3/cdnsp-pci.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Pawel Laszczak Oct. 10, 2022, 4:27 a.m. UTC | #1
>
>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.
>

Acked-by: Pawel Laszczak <pawell@cadence.com>

Thanks
Pawel,

>Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
>---
> 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
diff mbox series

Patch

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);
 }