diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index b605224fb9e32d0aa3927af4b036dcf08b2ac4ee..61de62cdb1dd78f08bcb67b4968ca40d1104ea30 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c @@ -56,14 +56,18 @@ static int of_isp1760_probe(struct platform_device *dev) return -ENOMEM; ret = of_address_to_resource(dp, 0, &memory); - if (ret) - return -ENXIO; + if (ret) { + ret = -ENXIO; + goto free_data; + } res_len = resource_size(&memory); res = request_mem_region(memory.start, res_len, dev_name(&dev->dev)); - if (!res) - return -EBUSY; + if (!res) { + ret = -EBUSY; + goto free_data; + } if (of_irq_map_one(dp, 0, &oirq)) { ret = -ENODEV; @@ -125,6 +129,7 @@ static int of_isp1760_probe(struct platform_device *dev) gpio_free(drvdata->rst_gpio); release_reg: release_mem_region(memory.start, res_len); +free_data: kfree(drvdata); return ret; }