[PATCH v1 23/32] usb: dwc2: gadget: abort core init if core_reset fails

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

 



From: Gregory Herrero <gregory.herrero@xxxxxxxxx>

No point of continue with initialization if core is not in a sane
state.

Signed-off-by: Gregory Herrero <gregory.herrero@xxxxxxxxx>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@xxxxxxxxx>
Tested-by: Robert Baldyga <r.baldyga@xxxxxxxxxxx>
---
 drivers/usb/dwc2/gadget.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 8783af8..e35b052 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2287,7 +2287,8 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
 	u32 val;
 
 	if (!is_usb_reset)
-		dwc2_hsotg_corereset(hsotg);
+		if (dwc2_hsotg_corereset(hsotg))
+			goto core_init_abort;
 
 	/*
 	 * we must now enable ep0 ready for host detection and then
@@ -2417,6 +2418,9 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
 
 	hsotg->last_rst = jiffies;
 	hsotg->lx_state = DWC2_L0;
+
+core_init_abort:
+	return;
 }
 
 static void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
-- 
2.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux