Skip to content

Commit 286afdd

Browse files
aakoskinFelipe Balbi
authored andcommitted
USB: omap_udc: use devm_request_irq()
The current code fails to release the third irq on the error path (observed by reading the code), and we get also multiple WARNs with failing gadget drivers due to duplicate IRQ releases. Fix by using devm_request_irq(). Signed-off-by: Aaro Koskinen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 38317f5 commit 286afdd

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

drivers/usb/gadget/udc/omap_udc.c

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2867,29 +2867,29 @@ static int omap_udc_probe(struct platform_device *pdev)
28672867
udc->clr_halt = UDC_RESET_EP;
28682868

28692869
/* USB general purpose IRQ: ep0, state changes, dma, etc */
2870-
status = request_irq(pdev->resource[1].start, omap_udc_irq,
2871-
0, driver_name, udc);
2870+
status = devm_request_irq(&pdev->dev, pdev->resource[1].start,
2871+
omap_udc_irq, 0, driver_name, udc);
28722872
if (status != 0) {
28732873
ERR("can't get irq %d, err %d\n",
28742874
(int) pdev->resource[1].start, status);
28752875
goto cleanup1;
28762876
}
28772877

28782878
/* USB "non-iso" IRQ (PIO for all but ep0) */
2879-
status = request_irq(pdev->resource[2].start, omap_udc_pio_irq,
2880-
0, "omap_udc pio", udc);
2879+
status = devm_request_irq(&pdev->dev, pdev->resource[2].start,
2880+
omap_udc_pio_irq, 0, "omap_udc pio", udc);
28812881
if (status != 0) {
28822882
ERR("can't get irq %d, err %d\n",
28832883
(int) pdev->resource[2].start, status);
2884-
goto cleanup2;
2884+
goto cleanup1;
28852885
}
28862886
#ifdef USE_ISO
2887-
status = request_irq(pdev->resource[3].start, omap_udc_iso_irq,
2888-
0, "omap_udc iso", udc);
2887+
status = devm_request_irq(&pdev->dev, pdev->resource[3].start,
2888+
omap_udc_iso_irq, 0, "omap_udc iso", udc);
28892889
if (status != 0) {
28902890
ERR("can't get irq %d, err %d\n",
28912891
(int) pdev->resource[3].start, status);
2892-
goto cleanup3;
2892+
goto cleanup1;
28932893
}
28942894
#endif
28952895
if (cpu_is_omap16xx() || cpu_is_omap7xx()) {
@@ -2902,22 +2902,11 @@ static int omap_udc_probe(struct platform_device *pdev)
29022902
create_proc_file();
29032903
status = usb_add_gadget_udc_release(&pdev->dev, &udc->gadget,
29042904
omap_udc_release);
2905-
if (status)
2906-
goto cleanup4;
2907-
2908-
return 0;
2905+
if (!status)
2906+
return 0;
29092907

2910-
cleanup4:
29112908
remove_proc_file();
29122909

2913-
#ifdef USE_ISO
2914-
cleanup3:
2915-
free_irq(pdev->resource[2].start, udc);
2916-
#endif
2917-
2918-
cleanup2:
2919-
free_irq(pdev->resource[1].start, udc);
2920-
29212910
cleanup1:
29222911
kfree(udc);
29232912
udc = NULL;
@@ -2961,12 +2950,6 @@ static int omap_udc_remove(struct platform_device *pdev)
29612950

29622951
remove_proc_file();
29632952

2964-
#ifdef USE_ISO
2965-
free_irq(pdev->resource[3].start, udc);
2966-
#endif
2967-
free_irq(pdev->resource[2].start, udc);
2968-
free_irq(pdev->resource[1].start, udc);
2969-
29702953
if (udc->dc_clk) {
29712954
if (udc->clk_requested)
29722955
omap_udc_enable_clock(0);

0 commit comments

Comments
 (0)