]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: dwc3: Fix remove function if there is no ulpi_reset gpio
authorVenkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Wed, 9 Aug 2023 03:33:50 +0000 (09:03 +0530)
committerMarek Vasut <marex@denx.de>
Fri, 25 Aug 2023 00:35:40 +0000 (02:35 +0200)
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: 237d1f60b1d ("usb: dwc3: Use the devm_gpiod_get_optional()
     API for reset gpio")

Reported-by: Thomas Nizan <tnizan@witekio.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
drivers/usb/dwc3/dwc3-generic.c

index b3ed728fd8487592a09147d3a3b031eb2daf9145..7f0af05855abb9b7a22e63c8b536cecd121b32b3 100644 (file)
@@ -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);