]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
usb: dwc2: pci: Move usb_phy_generic_register()
authorVardan Mikayelyan <mvardan@synopsys.com>
Fri, 19 Jan 2018 10:45:38 +0000 (14:45 +0400)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 13 Mar 2018 08:47:44 +0000 (10:47 +0200)
Move usb_phy_generic_register() function call to the top, to simplify
error handling. If this fails we can simply return instead of cleaning
up.

Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Vardan Mikayelyan <mvardan@synopsys.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc2/pci.c

index 8c6a65188412ff9b25f88427a720ec9e4308c792..11b8ffb6656b1594be551a96948769c031322c0d 100644 (file)
@@ -104,6 +104,13 @@ static int dwc2_pci_probe(struct pci_dev *pci,
 
        pci_set_master(pci);
 
+       phy = usb_phy_generic_register();
+       if (IS_ERR(phy)) {
+               dev_err(dev, "error registering generic PHY (%ld)\n",
+                       PTR_ERR(phy));
+               return PTR_ERR(phy);
+       }
+
        dwc2 = platform_device_alloc("dwc2", PLATFORM_DEVID_AUTO);
        if (!dwc2) {
                dev_err(dev, "couldn't allocate dwc2 device\n");
@@ -129,13 +136,6 @@ static int dwc2_pci_probe(struct pci_dev *pci,
 
        dwc2->dev.parent = dev;
 
-       phy = usb_phy_generic_register();
-       if (IS_ERR(phy)) {
-               dev_err(dev, "error registering generic PHY (%ld)\n",
-                       PTR_ERR(phy));
-               return PTR_ERR(phy);
-       }
-
        ret = dwc2_pci_quirks(pci, dwc2);
        if (ret)
                goto err;