Skip to contentSkip to conversation

usb: musb: Do not check 0 for platform_get_irq_byname()

PATCH In review Zhu Wang 2 participants 2 messages Aug 3, 2023

Subsystems (2)
lore
Share & tools
lore

Zhu Wang

author
#0 lore raw

PATCH v3 1/1 usb: musb: Do not check 0 for platform_get_irq_byname()

When platform_get_irq_byname() failed, it may return -EPROBE_DEFER, -EINVAL or -ENXIO, it is important to propagate the detail upstream, we cannot override it.

And platform_get_irq_byname() used to return 0 (as both IRQ0 and error indication), there are several patches fixing the inconsistencies.

Commit ce753ad1549c ("platform: finally disallow IRQ0 in platform_get_irq() and its ilk") makes sure IRQ0 is not returned.

---
Changes in v2:
- Update the commit message, present the reason of replacing the return value of the probe.

---
Changes in v3:
- Update the commit message, explain in detail why the return value of platform_get_irq_byname() cannot be override.

---
 drivers/usb/musb/musb_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb/musb_core.c +2 -2
index ecbd3784bec3..b24adb5b399f 100644
@@ -2610,8 +2610,8 @@ static int musb_probe(struct platform_device *pdev)
 	int		irq = platform_get_irq_byname(pdev, "mc");
 	void __iomem	*base;
 
-	if (irq <= 0)
-		return -ENODEV;
+	if (irq < 0)
+		return irq;
 
 	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base))
Signature · 1 line
2.17.1
#1 lore raw
Quoted 1 line · Zhu Wang

When platform_get_irq_byname() failed, it may return -EPROBE_DEFER,

s/failed/fails/, I think...

Quoted 2 lines

-EINVAL or -ENXIO, it is important to propagate the detail upstream, we cannot override it.

You better rename the patch to something like "usb: musb: Fix deferred
probing" now. And remove "-next:, as this became a real fix.

Quoted 2 lines

And platform_get_irq_byname() used to return 0 (as both IRQ0 and error indication), there are several patches fixing the inconsistencies.

In no way I suggested to take my "historical" passage into the
patch description!

Quoted 10 lines

Commit ce753ad1549c ("platform: finally disallow IRQ0 in platform_get_irq() and its ilk") makes sure IRQ0 is not returned.

---
Changes in v2:
- Update the commit message, present the reason of replacing the return value of the probe.

Quoted 4 lines

---
Changes in v3:
- Update the commit message, explain in detail why the return value of platform_get_irq_byname() cannot be override.

You didn't emphasize the deferred probing breakage we're trying to
fix here at last; the other error codes here are not very important...

[...]

MBR, Sergey