Patch "usb: dwc2: Add missing cleanups when usb_add_gadget_udc() fails" has been added to the 5.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    usb: dwc2: Add missing cleanups when usb_add_gadget_udc() fails

to the 5.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-dwc2-add-missing-cleanups-when-usb_add_gadget_ud.patch
and it can be found in the queue-5.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3cbd922e4a1d7fe4f621bb82beeacacb611cd515
Author: Martin Blumenstingl <martin.blumenstingl@xxxxxxxxxxxxxx>
Date:   Sat Jul 4 00:50:43 2020 +0200

    usb: dwc2: Add missing cleanups when usb_add_gadget_udc() fails
    
    [ Upstream commit e1c08cf23172ed6fb228d75efc9f4c80a6812116 ]
    
    Call dwc2_debugfs_exit() and dwc2_hcd_remove() (if the HCD was enabled
    earlier) when usb_add_gadget_udc() has failed. This ensures that the
    debugfs entries created by dwc2_debugfs_init() as well as the HCD are
    cleaned up in the error path.
    
    Fixes: 207324a321a866 ("usb: dwc2: Postponed gadget registration to the udc class driver")
    Acked-by: Minas Harutyunyan <hminas@xxxxxxxxxxxx>
    Signed-off-by: Martin Blumenstingl <martin.blumenstingl@xxxxxxxxxxxxxx>
    Signed-off-by: Felipe Balbi <balbi@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index db9fd4bd1a38c..b28e90e0b685d 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -584,12 +584,16 @@ static int dwc2_driver_probe(struct platform_device *dev)
 		if (retval) {
 			hsotg->gadget.udc = NULL;
 			dwc2_hsotg_remove(hsotg);
-			goto error_init;
+			goto error_debugfs;
 		}
 	}
 #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
 	return 0;
 
+error_debugfs:
+	dwc2_debugfs_exit(hsotg);
+	if (hsotg->hcd_enabled)
+		dwc2_hcd_remove(hsotg);
 error_init:
 	if (hsotg->params.activate_stm_id_vb_detection)
 		regulator_disable(hsotg->usb33d);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux