mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next v2] usb: musb: Do not check 0 for platform_get_irq_byname()
@ 2023-08-03 11:31 Zhu Wang
  2023-08-03 11:41 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Zhu Wang @ 2023-08-03 11:31 UTC (permalink / raw)
  To: b-liu, gregkh, linux-usb, linux-kernel, sergei.shtylyov; +Cc: wangzhu9

When platform_get_irq_byname() is called to get a interrupt number, it
may return -EINVAL or -ENXIO when failed, while current code returned
-ENODEV, so we replace it with the return value of
platform_get_irq_byname(). And we found that platform_get_irq_byname()
never returned zero by reading its code.

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

Signed-off-by: Zhu Wang <wangzhu9@huawei.com>

---
Changes in v2:
- Update the commit message, present the reason of replacing the return
value of the probe.
---
 drivers/usb/musb/musb_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index ecbd3784bec3..b24adb5b399f 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -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))
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -next v2] usb: musb: Do not check 0 for platform_get_irq_byname()
  2023-08-03 11:31 [PATCH -next v2] usb: musb: Do not check 0 for platform_get_irq_byname() Zhu Wang
@ 2023-08-03 11:41 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2023-08-03 11:41 UTC (permalink / raw)
  To: Zhu Wang, b-liu, gregkh, linux-usb, linux-kernel

On 8/3/23 2:31 PM, Zhu Wang wrote:

> When platform_get_irq_byname() is called to get a interrupt number, it
> may return -EINVAL or -ENXIO when failed, while current code returned

   You still don't mention -EPROBE_DEFER. Propagating it upstream is
the _main_ reason we must not override what platform_get_irq_byname()
returns!

> -ENODEV, so we replace it with the return value of
> platform_get_irq_byname(). And we found that platform_get_irq_byname()
> never returned zero by reading its code.

   It used to return 0 (as both IRQ0 and the error indication).
Historically, there were several patches fixing the inconsistencies...

> Commit ce753ad1549c ("platform: finally disallow IRQ0 in
> platform_get_irq() and its ilk") makes sure IRQ0 is not returned.
> 
> Signed-off-by: Zhu Wang <wangzhu9@huawei.com>
> 
> ---
> Changes in v2:
> - Update the commit message, present the reason of replacing the return
> value of the probe.
> ---
>  drivers/usb/musb/musb_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index ecbd3784bec3..b24adb5b399f 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -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))
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-03 11:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-03 11:31 [PATCH -next v2] usb: musb: Do not check 0 for platform_get_irq_byname() Zhu Wang
2023-08-03 11:41 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®