summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorVardan Mikayelyan <mvardan@synopsys.com>2018-01-19 14:46:30 +0400
committerFelipe Balbi <felipe.balbi@linux.intel.com>2018-03-13 10:47:45 +0200
commitecd29dabb2ba2e4a29339bf55129fd1058107206 (patch)
treeda139553399869312f30a19318e5e2e023072746 /drivers/usb
parentfb50aacdcf124d98ed93d4cc87867aa60011b52d (diff)
downloadblackbird-op-linux-ecd29dabb2ba2e4a29339bf55129fd1058107206.tar.gz
blackbird-op-linux-ecd29dabb2ba2e4a29339bf55129fd1058107206.zip
usb: dwc2: pci: Handle error cleanup in probe
The probe function doesn't properly handle errors. Fix it so that it properly handles cleanup. 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>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc2/pci.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/dwc2/pci.c b/drivers/usb/dwc2/pci.c
index 0943f0d40fe4..7f21747007f1 100644
--- a/drivers/usb/dwc2/pci.c
+++ b/drivers/usb/dwc2/pci.c
@@ -114,7 +114,7 @@ static int dwc2_pci_probe(struct pci_dev *pci,
dwc2 = platform_device_alloc("dwc2", PLATFORM_DEVID_AUTO);
if (!dwc2) {
dev_err(dev, "couldn't allocate dwc2 device\n");
- return -ENOMEM;
+ goto err;
}
memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res));
@@ -131,7 +131,7 @@ static int dwc2_pci_probe(struct pci_dev *pci,
ret = platform_device_add_resources(dwc2, res, ARRAY_SIZE(res));
if (ret) {
dev_err(dev, "couldn't add resources to dwc2 device\n");
- return ret;
+ goto err;
}
dwc2->dev.parent = dev;
@@ -142,7 +142,7 @@ static int dwc2_pci_probe(struct pci_dev *pci,
glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL);
if (!glue)
- return -ENOMEM;
+ goto err;
ret = platform_device_add(dwc2);
if (ret) {
OpenPOWER on IntegriCloud