From: Venkatesh Yadav Abbarapu Date: Wed, 9 Aug 2023 03:33:50 +0000 (+0530) Subject: usb: dwc3: Fix remove function if there is no ulpi_reset gpio X-Git-Tag: baikal/mips/sdk6.2~4^2~3^2~24^2~2 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=0fab1a14ecfd9aa928d4ce772bf1e23c1382aee6;p=uboot.git usb: dwc3: Fix remove function if there is no ulpi_reset gpio As ulpi_reset gpio is now optional, we need to check it when doing the 'dwc3_generic_remove' function. Check if it is declared before accessing the ulpi_reset. Fixes: 506d66e987e ("usb: dwc3: Use the devm_gpiod_get_optional() API for reset gpio") Reported-by: Thomas Nizan Signed-off-by: Venkatesh Yadav Abbarapu --- diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index b3ed728fd8..7f0af05855 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -145,7 +145,8 @@ static int dwc3_generic_remove(struct udevice *dev, struct dwc3 *dwc3 = &priv->dwc3; if (CONFIG_IS_ENABLED(DM_GPIO) && - device_is_compatible(dev->parent, "xlnx,zynqmp-dwc3")) { + device_is_compatible(dev->parent, "xlnx,zynqmp-dwc3") && + priv->ulpi_reset) { struct gpio_desc *ulpi_reset = priv->ulpi_reset; dm_gpio_free(ulpi_reset->dev, ulpi_reset);