Skip to contentSkip to conversation

usb: dwc3: meson-g12a: add missed regulator_disable

PATCH In review Chuhong Yuan 2 participants 2 messages Nov 18, 2019 – Nov 19, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc3: meson-g12a: add missed regulator_disable

The driver forgets to disable the regulator in probe failure and remove. Add the missed calls to fix it.

---
 drivers/usb/dwc3/dwc3-meson-g12a.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/usb/dwc3/dwc3-meson-g12a.c +8 -3
index 8a3ec1a951fe..d9723d1ad8eb 100644
@@ -458,7 +458,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 						dwc3_meson_g12a_irq_thread,
 						IRQF_ONESHOT, pdev->name, priv);
 		if (ret)
-			return ret;
+			goto err_regulator_disable;
 	}
 
 	dwc3_meson_g12a_usb_init(priv);
@@ -467,7 +467,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 	for (i = 0 ; i < PHY_COUNT ; ++i) {
 		ret = phy_init(priv->phys[i]);
 		if (ret)
-			return ret;
+			goto err_regulator_disable;
 	}
 
 	/* Set PHY Power */
@@ -517,7 +517,9 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 err_phys_exit:
 	for (i = 0 ; i < PHY_COUNT ; ++i)
 		phy_exit(priv->phys[i]);
-
+err_regulator_disable:
+	if (priv->vbus)
+		regulator_disable(priv->vbus);
 	return ret;
 }
 
@@ -536,6 +538,9 @@ static int dwc3_meson_g12a_remove(struct platform_device *pdev)
 		phy_exit(priv->phys[i]);
 	}
 
+	if (priv->vbus)
+		regulator_disable(priv->vbus);
+
 	pm_runtime_disable(dev);
 	pm_runtime_put_noidle(dev);
 	pm_runtime_set_suspended(dev);
Signature · 1 line
2.24.0
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Chuhong Yuan

The driver forgets to disable the regulator in probe failure and remove. Add the missed calls to fix it.

Fixes f90db10779ad ("usb: dwc3: meson-g12a: Add support for IRQ based OTG switching")
Quoted 39 lines
---
 drivers/usb/dwc3/dwc3-meson-g12a.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/usb/dwc3/dwc3-meson-g12a.c +5 -3
index 8a3ec1a951fe..d9723d1ad8eb 100644
@@ -458,7 +458,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 						dwc3_meson_g12a_irq_thread,
 						IRQF_ONESHOT, pdev->name, priv);
 		if (ret)
-			return ret;
+			goto err_regulator_disable;
 	}
 
 	dwc3_meson_g12a_usb_init(priv);
@@ -467,7 +467,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 	for (i = 0 ; i < PHY_COUNT ; ++i) {
 		ret = phy_init(priv->phys[i]);
 		if (ret)
-			return ret;
+			goto err_regulator_disable;
 	}
 
 	/* Set PHY Power */
@@ -517,7 +517,9 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 err_phys_exit:
 	for (i = 0 ; i < PHY_COUNT ; ++i)
 		phy_exit(priv->phys[i]);
-
+err_regulator_disable:
+	if (priv->vbus)
+		regulator_disable(priv->vbus);
 	return ret;
 }
 

drivers/usb/dwc3/dwc3-meson-g12a.c static int dwc3_meson_g12a_remove(struct platform_device *pdev) · line 546

Quoted 9 lines
drivers/usb/dwc3/dwc3-meson-g12a.c +3 -0
@@ -536,6 +538,9 @@ static int dwc3_meson_g12a_remove(struct platform_device *pdev)
 		phy_exit(priv->phys[i]);
 	}
 
+	if (priv->vbus)
+		regulator_disable(priv->vbus);
+
 	pm_runtime_disable(dev);
 	pm_runtime_put_noidle(dev);
 	pm_runtime_set_suspended(dev);