]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: dwc3: fix NULL pointer issue
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Thu, 14 May 2020 05:55:11 +0000 (13:55 +0800)
committerMarek Vasut <marek.vasut+renesas@gmail.com>
Fri, 22 May 2020 13:22:36 +0000 (15:22 +0200)
The phy_bulk pointer *usb_phys is used before allocated,
fix it by using a phy_bulk variable instead in
xhci_dwc3_platdata struct

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
drivers/usb/host/xhci-dwc3.c

index cf72f0236d4fdae9130b34bd3046f8f9a30a15f2..27f84102db380c3f02d2c6ecab44a56c6564e2ee 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/usb/otg.h>
 
 struct xhci_dwc3_platdata {
-       struct phy_bulk *usb_phys;
+       struct phy_bulk phys;
 };
 
 void dwc3_set_mode(struct dwc3 *dwc3_reg, u32 mode)
@@ -126,7 +126,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
        hcor = (struct xhci_hcor *)((uintptr_t)hccr +
                        HC_LENGTH(xhci_readl(&(hccr)->cr_capbase)));
 
-       ret = dwc3_setup_phy(dev, plat->usb_phys);
+       ret = dwc3_setup_phy(dev, &plat->phys);
        if (ret && (ret != -ENOTSUPP))
                return ret;
 
@@ -169,7 +169,7 @@ static int xhci_dwc3_remove(struct udevice *dev)
 {
        struct xhci_dwc3_platdata *plat = dev_get_platdata(dev);
 
-       dwc3_shutdown_phy(dev, plat->usb_phys);
+       dwc3_shutdown_phy(dev, &plat->phys);
 
        return xhci_deregister(dev);
 }