Skip to contentSkip to conversation

usb: gadget: udc: snps_udc_plat: use platform_get_irq for IRQ lookup

PATCH New Rosen Penev 2 participants 2 messages Nov 11 USB

lore
Share & tools
lore
#0 lore raw

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.

---
 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
index 3687690ca33d..38aa077a56b5 100644
@@ -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
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

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.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1