From: Steffen Dirkwinkel <s.dirkwin...@beckhoff.com>

This gpio is optional so undonditionally freeing it will crash.

Signed-off-by: Steffen Dirkwinkel <s.dirkwin...@beckhoff.com>
---

 drivers/usb/dwc3/dwc3-generic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 7f0af05855..dcc342ed04 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -149,7 +149,9 @@ static int dwc3_generic_remove(struct udevice *dev,
            priv->ulpi_reset) {
                struct gpio_desc *ulpi_reset = priv->ulpi_reset;
 
-               dm_gpio_free(ulpi_reset->dev, ulpi_reset);
+               if (priv->ulpi_reset) {
+                       dm_gpio_free(ulpi_reset->dev, ulpi_reset);
+               }
        }
 
        dwc3_remove(dwc3);
-- 
2.42.0

Reply via email to