aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/gadget/amd5536udc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index b663f23f2642..fc6f3483be44 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -3248,6 +3248,8 @@ static int udc_pci_probe(
3248 3248
3249 /* pci setup */ 3249 /* pci setup */
3250 if (pci_enable_device(pdev) < 0) { 3250 if (pci_enable_device(pdev) < 0) {
3251 kfree(dev);
3252 dev = 0;
3251 retval = -ENODEV; 3253 retval = -ENODEV;
3252 goto finished; 3254 goto finished;
3253 } 3255 }
@@ -3259,6 +3261,8 @@ static int udc_pci_probe(
3259 3261
3260 if (!request_mem_region(resource, len, name)) { 3262 if (!request_mem_region(resource, len, name)) {
3261 dev_dbg(&pdev->dev, "pci device used already\n"); 3263 dev_dbg(&pdev->dev, "pci device used already\n");
3264 kfree(dev);
3265 dev = 0;
3262 retval = -EBUSY; 3266 retval = -EBUSY;
3263 goto finished; 3267 goto finished;
3264 } 3268 }
@@ -3267,18 +3271,24 @@ static int udc_pci_probe(
3267 dev->virt_addr = ioremap_nocache(resource, len); 3271 dev->virt_addr = ioremap_nocache(resource, len);
3268 if (dev->virt_addr == NULL) { 3272 if (dev->virt_addr == NULL) {
3269 dev_dbg(&pdev->dev, "start address cannot be mapped\n"); 3273 dev_dbg(&pdev->dev, "start address cannot be mapped\n");
3274 kfree(dev);
3275 dev = 0;
3270 retval = -EFAULT; 3276 retval = -EFAULT;
3271 goto finished; 3277 goto finished;
3272 } 3278 }
3273 3279
3274 if (!pdev->irq) { 3280 if (!pdev->irq) {
3275 dev_err(&dev->pdev->dev, "irq not set\n"); 3281 dev_err(&dev->pdev->dev, "irq not set\n");
3282 kfree(dev);
3283 dev = 0;
3276 retval = -ENODEV; 3284 retval = -ENODEV;
3277 goto finished; 3285 goto finished;
3278 } 3286 }
3279 3287
3280 if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) { 3288 if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) {
3281 dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq); 3289 dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq);
3290 kfree(dev);
3291 dev = 0;
3282 retval = -EBUSY; 3292 retval = -EBUSY;
3283 goto finished; 3293 goto finished;
3284 } 3294 }