[PATCH 2/5] drivers/usb/dwc3: zynqmp: only free reset gpio if we have one
Steffen Dirkwinkel
lists at steffen.cc
Wed Aug 30 16:03:31 CEST 2023
From: Steffen Dirkwinkel <s.dirkwinkel at beckhoff.com>
This gpio is optional so undonditionally freeing it will crash.
Signed-off-by: Steffen Dirkwinkel <s.dirkwinkel at 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
More information about the U-Boot
mailing list