[PATCH] driver/usb/dwc3: Add error handle for dwc3 get usb phy

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

 



Add error handle for dwc3 core get usb phy, because
without error handle will lead to bug.

consider case like this, when both dwc->usb2_phy/usb3_phy
and dwc->usb2_generic_phy/usb3_generic_phy do not exist
current driver code set them all to NULL and return 0
to caller which means usb phy is ready.

Signed-off-by: Yuan Fang <yuan.fang@xxxxxxxxxxxxxxx>
---
Hi maintainer,

   I find this issue when i try to add a new usb phy driver for
   dwc3 usb core, this issue looks like a bug, please kindly have
   a review, many thanks.

Best regards,
Yuan Fang

 drivers/usb/dwc3/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index b6e53d8212cd..4d527d313a4c 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1184,6 +1184,7 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
 		ret = PTR_ERR(dwc->usb3_generic_phy);
 		if (ret == -ENOSYS || ret == -ENODEV) {
 			dwc->usb3_generic_phy = NULL;
+			return dev_err_probe(dev, ret, "no usb phy device\n");
 		} else {
 			return dev_err_probe(dev, ret, "no usb3 phy configured\n");
 		}
-- 
2.17.1




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

  Powered by Linux