Commit a127cccd authored by Vardan Mikayelyan's avatar Vardan Mikayelyan Committed by Felipe Balbi

usb: dwc2: pci: Move usb_phy_generic_register()

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: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarVardan Mikayelyan <mvardan@synopsys.com>
Signed-off-by: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarGrigor Tovmasyan <tovmasya@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent b10129de
...@@ -104,6 +104,13 @@ static int dwc2_pci_probe(struct pci_dev *pci, ...@@ -104,6 +104,13 @@ static int dwc2_pci_probe(struct pci_dev *pci,
pci_set_master(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); dwc2 = platform_device_alloc("dwc2", PLATFORM_DEVID_AUTO);
if (!dwc2) { if (!dwc2) {
dev_err(dev, "couldn't allocate dwc2 device\n"); dev_err(dev, "couldn't allocate dwc2 device\n");
...@@ -129,13 +136,6 @@ static int dwc2_pci_probe(struct pci_dev *pci, ...@@ -129,13 +136,6 @@ static int dwc2_pci_probe(struct pci_dev *pci,
dwc2->dev.parent = dev; 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); ret = dwc2_pci_quirks(pci, dwc2);
if (ret) if (ret)
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment