usb: gadget: udc: snps_udc_plat: use platform_get_irq for IRQ lookup
PATCH 1/1 usb: gadget: udc: snps_udc_plat: use platform_get_irq for IRQ lookup
Replace irq_of_parse_and_map() with platform_get_irq() and move the IRQ acquisition to the top of the probe function, before any resource allocation. This provides proper error propagation including -EPROBE_DEFER support and removes the need for a manual error message.
Signed-off-by Rosen Penev <[email protected]>
--- drivers/usb/gadget/udc/snps_udc_plat.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/usb/gadget/udc/snps_udc_plat.c +6 -5
@@ -102,8 +102,13 @@ static int udc_plat_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct resource *res;struct udc *udc; +int irq;int ret; + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return irq; + udc =devm_kzalloc_obj (dev, *udc);if (!udc)return -ENOMEM ;
@@ -130,11 +135,7 @@ static int udc_plat_probe(struct platform_device *pdev) udc->phys_addr = (unsigned long )res->start; - udc->irq =irq_of_parse_and_map (dev->of_node,0 ); -if (udc->irq <=0 ) { -dev_err (dev,"Can't parse and map interrupt\n" ); -return -EINVAL ; - } + udc->irq = irq; udc->udc_phy =devm_of_phy_get_by_index (dev, dev->of_node,0 );if (IS_ERR (udc->udc_phy)) {
Signature · 1 line
2.56.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 6 lines
Replace
irq_of_parse_and_map()withplatform_get_irq()and move the IRQ acquisition to the top of the probe function, before any resource allocation. This provides proper error propagation including -EPROBE_DEFER support and removes the need for a manual error message.Signed-off-by Rosen Penev <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1