usb: gadget: fusb300_udc: free irq on the error path in fusb300_probe()

When request_irq(ires1->start) failed in w5300_hw_probe(), irq
ires->start has not been freed, and on the clean_up3 error path,
we also need to free ires1->start irq, fix it.

In addition, We should add free_irq in fusb300_remove(), and give
the lables a proper name so that they can be understood easily,
so add free_irq in fusb300_remove(), and update clean_up3 to
err_alloc_request.

Fixes: 0fe6f1d1f6 ("usb: udc: add Faraday fusb300 driver")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Link: https://lore.kernel.org/r/20221123014121.1989721-1-cuigaosheng1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Gaosheng Cui 2022-11-23 09:41:21 +08:00 committed by Greg Kroah-Hartman
parent 001b0c780e
commit a8d3392e0e

View file

@ -1347,6 +1347,7 @@ static int fusb300_remove(struct platform_device *pdev)
usb_del_gadget_udc(&fusb300->gadget); usb_del_gadget_udc(&fusb300->gadget);
iounmap(fusb300->reg); iounmap(fusb300->reg);
free_irq(platform_get_irq(pdev, 0), fusb300); free_irq(platform_get_irq(pdev, 0), fusb300);
free_irq(platform_get_irq(pdev, 1), fusb300);
fusb300_free_request(&fusb300->ep[0]->ep, fusb300->ep0_req); fusb300_free_request(&fusb300->ep[0]->ep, fusb300->ep0_req);
for (i = 0; i < FUSB300_MAX_NUM_EP; i++) for (i = 0; i < FUSB300_MAX_NUM_EP; i++)
@ -1432,7 +1433,7 @@ static int fusb300_probe(struct platform_device *pdev)
IRQF_SHARED, udc_name, fusb300); IRQF_SHARED, udc_name, fusb300);
if (ret < 0) { if (ret < 0) {
pr_err("request_irq1 error (%d)\n", ret); pr_err("request_irq1 error (%d)\n", ret);
goto clean_up; goto err_request_irq1;
} }
INIT_LIST_HEAD(&fusb300->gadget.ep_list); INIT_LIST_HEAD(&fusb300->gadget.ep_list);
@ -1471,7 +1472,7 @@ static int fusb300_probe(struct platform_device *pdev)
GFP_KERNEL); GFP_KERNEL);
if (fusb300->ep0_req == NULL) { if (fusb300->ep0_req == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto clean_up3; goto err_alloc_request;
} }
init_controller(fusb300); init_controller(fusb300);
@ -1486,7 +1487,10 @@ static int fusb300_probe(struct platform_device *pdev)
err_add_udc: err_add_udc:
fusb300_free_request(&fusb300->ep[0]->ep, fusb300->ep0_req); fusb300_free_request(&fusb300->ep[0]->ep, fusb300->ep0_req);
clean_up3: err_alloc_request:
free_irq(ires1->start, fusb300);
err_request_irq1:
free_irq(ires->start, fusb300); free_irq(ires->start, fusb300);
clean_up: clean_up: