* [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers
@ 2021-10-26 17:39 Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
` (21 more replies)
0 siblings, 22 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Greg Kroah-Hartman, Alan Stern, Mathias Nyman
Here are 22 patches against the 'usb-next' branch of Greg KH's 'usb.git' repo.
The affected drivers use platform_get_irq() which can return IRQ0 (considered
invalid, according to Linus) that means broken HCD when passed to usb_add_hcd()
called at the end of the probe() methods.
Sergey Shtylyov (22):
usb: host: ehci-exynos: deny IRQ0
usb: host: ehci-mv: deny IRQ0
usb: host: ehci-npcm7xx: deny IRQ0
usb: host: ehci-omap: deny IRQ0
usb: host: ehci-platform: deny IRQ0
usb: host: ehci-spear: deny IRQ0
usb: host: ehci-st: deny IRQ0
usb: host: ohci-at91: deny IRQ0
usb: host: ohci-da8xx: deny IRQ0
usb: host: ohci-exynos: deny IRQ0
usb: host: ohci-at91: deny IRQ0
usb: host: ohci-omap: deny IRQ0
usb: host: ohci-platform: deny IRQ0
usb: host: ohci-pxa27x: deny IRQ0
usb: host: ohci-sm501: deny IRQ0
usb: host: ohci-spear: deny IRQ0
usb: host: ohci-st: deny IRQ0
usb: host: ohci-tmio: deny IRQ0
usb: host: xhci-histb: deny IRQ0
usb: host: xhci-mtk: deny IRQ0
usb: host: xhci-plat: deny IRQ0
usb: host: xhci-tegra: deny IRQ0
drivers/usb/host/ehci-exynos.c | 4 ++++
drivers/usb/host/ehci-mv.c | 4 ++++
drivers/usb/host/ehci-npcm7xx.c | 4 ++++
drivers/usb/host/ehci-omap.c | 2 ++
drivers/usb/host/ehci-platform.c | 2 ++
drivers/usb/host/ehci-spear.c | 4 ++++
drivers/usb/host/ehci-st.c | 2 ++
drivers/usb/host/ohci-at91.c | 2 ++
drivers/usb/host/ohci-da8xx.c | 4 ++++
drivers/usb/host/ohci-exynos.c | 4 ++++
drivers/usb/host/ohci-nxp.c | 4 ++++
drivers/usb/host/ohci-omap.c | 4 ++++
drivers/usb/host/ohci-platform.c | 2 ++
drivers/usb/host/ohci-pxa27x.c | 2 ++
drivers/usb/host/ohci-sm501.c | 4 ++++
drivers/usb/host/ohci-spear.c | 4 ++++
drivers/usb/host/ohci-st.c | 2 ++
drivers/usb/host/ohci-tmio.c | 2 ++
drivers/usb/host/xhci-histb.c | 2 ++
drivers/usb/host/xhci-mtk.c | 4 +++-
drivers/usb/host/xhci-plat.c | 2 ++
drivers/usb/host/xhci-tegra.c | 2 ++
22 files changed, 65 insertions(+), 1 deletion(-)
--
2.26.3
^ permalink raw reply [flat|nested] 63+ messages in thread
* [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 02/22] usb: host: ehci-mv: " Sergey Shtylyov
` (20 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Krzysztof Kozlowski, linux-arm-kernel, linux-samsung-soc
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ehci-exynos.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index 1a9b7572e17f..ff4e1261801a 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -207,6 +207,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
err = irq;
goto fail_io;
}
+ if (!irq) {
+ err = -EINVAL;
+ goto fail_io;
+ }
err = exynos_ehci_phy_enable(&pdev->dev);
if (err) {
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
@ 2021-10-26 17:39 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Krzysztof Kozlowski, linux-arm-kernel, linux-samsung-soc
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ehci-exynos.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index 1a9b7572e17f..ff4e1261801a 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -207,6 +207,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
err = irq;
goto fail_io;
}
+ if (!irq) {
+ err = -EINVAL;
+ goto fail_io;
+ }
err = exynos_ehci_phy_enable(&pdev->dev);
if (err) {
--
2.26.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 02/22] usb: host: ehci-mv: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
` (19 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: a7f40c233a6b ("USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ehci-mv.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index 8fd27249ad25..f54ce1eeccf3 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -168,6 +168,10 @@ static int mv_ehci_probe(struct platform_device *pdev)
retval = platform_get_irq(pdev, 0);
if (retval < 0)
goto err_disable_clk;
+ if (!retval) {
+ retval = -EINVAL;
+ goto err_disable_clk;
+ }
hcd->irq = retval;
ehci = hcd_to_ehci(hcd);
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 03/22] usb: host: ehci-npcm7xx: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 02/22] usb: host: ehci-mv: " Sergey Shtylyov
` (20 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Avi Fishman, Tomer Maimon, Tali Perry, Patrick Venture,
Nancy Yuen, Benjamin Fair, openbmc
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: df44831ee2dd ("USB host: Add USB ehci support for nuvoton npcm7xx platform")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reviewed-by: Avi Fishman <avifishman70@gmail.com>
---
Changes in version 2:
- added Alan's ACK and also Avi's tag.
drivers/usb/host/ehci-npcm7xx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ehci-npcm7xx.c b/drivers/usb/host/ehci-npcm7xx.c
index 6b5a7a873e01..aff3d906ced5 100644
--- a/drivers/usb/host/ehci-npcm7xx.c
+++ b/drivers/usb/host/ehci-npcm7xx.c
@@ -114,6 +114,10 @@ static int npcm7xx_ehci_hcd_drv_probe(struct platform_device *pdev)
retval = irq;
goto fail;
}
+ if (!irq) {
+ retval = -EINVAL;
+ goto fail;
+ }
/*
* Right now device-tree probed devices don't get dma_mask set.
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 03/22] usb: host: ehci-npcm7xx: deny IRQ0
@ 2021-10-26 17:39 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Benjamin Fair, Avi Fishman, Patrick Venture, openbmc, Tali Perry,
Tomer Maimon
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: df44831ee2dd ("USB host: Add USB ehci support for nuvoton npcm7xx platform")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reviewed-by: Avi Fishman <avifishman70@gmail.com>
---
Changes in version 2:
- added Alan's ACK and also Avi's tag.
drivers/usb/host/ehci-npcm7xx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ehci-npcm7xx.c b/drivers/usb/host/ehci-npcm7xx.c
index 6b5a7a873e01..aff3d906ced5 100644
--- a/drivers/usb/host/ehci-npcm7xx.c
+++ b/drivers/usb/host/ehci-npcm7xx.c
@@ -114,6 +114,10 @@ static int npcm7xx_ehci_hcd_drv_probe(struct platform_device *pdev)
retval = irq;
goto fail;
}
+ if (!irq) {
+ retval = -EINVAL;
+ goto fail;
+ }
/*
* Right now device-tree probed devices don't get dma_mask set.
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 04/22] usb: host: ehci-omap: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (2 preceding siblings ...)
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-30 19:49 ` kernel test robot
2021-10-26 17:39 ` Sergey Shtylyov
` (17 subsequent siblings)
21 siblings, 1 reply; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman; +Cc: linux-omap
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: b33f37064b74 ("USB: host: ehci: introduce omap ehci-hcd driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ehci-omap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 7f4a03e8647a..79cec242c025 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -117,6 +117,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -ENIVAL;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
regs = devm_ioremap_resource(dev, res);
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 05/22] usb: host: ehci-platform: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 02/22] usb: host: ehci-mv: " Sergey Shtylyov
` (20 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman; +Cc: linux-arm-kernel
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 7a7a4a592f42 ("USB: EHCI: Add a generic platform device driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ehci-platform.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index c70f2d0b4aaf..1b20af65d799 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -265,6 +265,8 @@ static int ehci_platform_probe(struct platform_device *dev)
irq = platform_get_irq(dev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev,
dev_name(&dev->dev));
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 05/22] usb: host: ehci-platform: deny IRQ0
@ 2021-10-26 17:39 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman; +Cc: linux-arm-kernel
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 7a7a4a592f42 ("USB: EHCI: Add a generic platform device driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ehci-platform.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index c70f2d0b4aaf..1b20af65d799 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -265,6 +265,8 @@ static int ehci_platform_probe(struct platform_device *dev)
irq = platform_get_irq(dev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev,
dev_name(&dev->dev));
--
2.26.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 06/22] usb: host: ehci-spear: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (4 preceding siblings ...)
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
` (15 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: c8c38de9d800 ("USB host: Adding USB ehci & ohci support for spear platform")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ehci-spear.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index 3694e450a11a..f4a5896900dc 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -70,6 +70,10 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev)
retval = irq;
goto fail;
}
+ if (!irq) {
+ retval = -EINVAL;
+ goto fail;
+ }
/*
* Right now device-tree probed devices don't get dma_mask set.
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 07/22] usb: host: ehci-st: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 02/22] usb: host: ehci-mv: " Sergey Shtylyov
` (20 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Patrice Chotard, linux-arm-kernel
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: e47c5a0906f9 ("usb: host: ehci-st: Add EHCI support for ST STB devices")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ehci-st.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ehci-st.c b/drivers/usb/host/ehci-st.c
index f74433aac948..5f53c313f943 100644
--- a/drivers/usb/host/ehci-st.c
+++ b/drivers/usb/host/ehci-st.c
@@ -160,6 +160,8 @@ static int st_ehci_platform_probe(struct platform_device *dev)
irq = platform_get_irq(dev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!res_mem) {
dev_err(&dev->dev, "no memory resource provided");
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 07/22] usb: host: ehci-st: deny IRQ0
@ 2021-10-26 17:39 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Patrice Chotard, linux-arm-kernel
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: e47c5a0906f9 ("usb: host: ehci-st: Add EHCI support for ST STB devices")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ehci-st.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ehci-st.c b/drivers/usb/host/ehci-st.c
index f74433aac948..5f53c313f943 100644
--- a/drivers/usb/host/ehci-st.c
+++ b/drivers/usb/host/ehci-st.c
@@ -160,6 +160,8 @@ static int st_ehci_platform_probe(struct platform_device *dev)
irq = platform_get_irq(dev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!res_mem) {
dev_err(&dev->dev, "no memory resource provided");
--
2.26.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 08/22] usb: host: ohci-at91: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 02/22] usb: host: ehci-mv: " Sergey Shtylyov
` (20 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Nicolas Ferre, Alexandre Belloni, Ludovic Desroches, linux-arm-kernel
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: fb5f1834c322 ("usb: ohci-at91: fix irq and iomem resource retrieval")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-at91.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index a24aea3d2759..6a7276a730d1 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -181,6 +181,8 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
dev_dbg(dev, "hcd probe: missing irq resource\n");
return irq;
}
+ if (!irq)
+ return -EINVAL;
hcd = usb_create_hcd(driver, dev, "at91");
if (!hcd)
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 08/22] usb: host: ohci-at91: deny IRQ0
@ 2021-10-26 17:39 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Alexandre Belloni, Ludovic Desroches, linux-arm-kernel
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: fb5f1834c322 ("usb: ohci-at91: fix irq and iomem resource retrieval")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-at91.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index a24aea3d2759..6a7276a730d1 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -181,6 +181,8 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
dev_dbg(dev, "hcd probe: missing irq resource\n");
return irq;
}
+ if (!irq)
+ return -EINVAL;
hcd = usb_create_hcd(driver, dev, "at91");
if (!hcd)
--
2.26.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 09/22] usb: host: ohci-da8xx: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (7 preceding siblings ...)
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
` (12 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: efe7daf2231a ("USB: OHCI: DA8xx/OMAP-L1x glue layer")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-da8xx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index 1371b0c249ec..6d08ab2bf163 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -449,6 +449,10 @@ static int ohci_da8xx_probe(struct platform_device *pdev)
error = -ENODEV;
goto err;
}
+ if (!hcd_irq) {
+ error = -EINVAL;
+ goto err;
+ }
error = usb_add_hcd(hcd, hcd_irq, 0);
if (error)
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 10/22] usb: host: ohci-exynos: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 02/22] usb: host: ehci-mv: " Sergey Shtylyov
` (20 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Krzysztof Kozlowski, linux-arm-kernel, linux-samsung-soc
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 1d4169834628 ("usb: host: ohci-exynos: Fix error handling in exynos_ohci_probe()")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-exynos.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 5f5e8a64c8e2..f28f28e42f43 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -175,6 +175,10 @@ static int exynos_ohci_probe(struct platform_device *pdev)
err = irq;
goto fail_io;
}
+ if (!irq) {
+ err = -EINVAL;
+ goto fail_io;
+ }
platform_set_drvdata(pdev, hcd);
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 10/22] usb: host: ohci-exynos: deny IRQ0
@ 2021-10-26 17:39 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Krzysztof Kozlowski, linux-arm-kernel, linux-samsung-soc
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 1d4169834628 ("usb: host: ohci-exynos: Fix error handling in exynos_ohci_probe()")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-exynos.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 5f5e8a64c8e2..f28f28e42f43 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -175,6 +175,10 @@ static int exynos_ohci_probe(struct platform_device *pdev)
err = irq;
goto fail_io;
}
+ if (!irq) {
+ err = -EINVAL;
+ goto fail_io;
+ }
platform_set_drvdata(pdev, hcd);
--
2.26.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 11/22] usb: host: ohci-nxp: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 02/22] usb: host: ehci-mv: " Sergey Shtylyov
` (20 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Vladimir Zapolskiy, linux-arm-kernel
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 60bbfc84b6d9 ("USB OHCI controller support for PNX4008")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- fixed the subject to match the patch;
- added Alan's ACK.
drivers/usb/host/ohci-nxp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index 85878e8ad331..afb9c2fc85c3 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -215,6 +215,10 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
ret = -ENXIO;
goto fail_resource;
}
+ if (!irq) {
+ ret = -EINVAL;
+ goto fail_resource;
+ }
ohci_nxp_start_hc();
platform_set_drvdata(pdev, hcd);
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 11/22] usb: host: ohci-nxp: deny IRQ0
@ 2021-10-26 17:39 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Vladimir Zapolskiy, linux-arm-kernel
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 60bbfc84b6d9 ("USB OHCI controller support for PNX4008")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- fixed the subject to match the patch;
- added Alan's ACK.
drivers/usb/host/ohci-nxp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index 85878e8ad331..afb9c2fc85c3 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -215,6 +215,10 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
ret = -ENXIO;
goto fail_resource;
}
+ if (!irq) {
+ ret = -EINVAL;
+ goto fail_resource;
+ }
ohci_nxp_start_hc();
platform_set_drvdata(pdev, hcd);
--
2.26.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 12/22] usb: host: ohci-omap: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (10 preceding siblings ...)
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 13/22] usb: host: ohci-platform: " Sergey Shtylyov
` (9 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman; +Cc: linux-omap
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 489447380a29 ("[PATCH] handle errors returned by platform_get_irq*()")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-omap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index ded9738392e4..6d5f964d0995 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -309,6 +309,10 @@ static int ohci_hcd_omap_probe(struct platform_device *pdev)
retval = -ENXIO;
goto err3;
}
+ if (!irq) {
+ retval = -EINVAL;
+ goto err3;
+ }
retval = usb_add_hcd(hcd, irq, 0);
if (retval)
goto err3;
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 13/22] usb: host: ohci-platform: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (11 preceding siblings ...)
2021-10-26 17:39 ` [PATCH v2 12/22] usb: host: ohci-omap: " Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 14/22] usb: host: ohci-pxa27x: " Sergey Shtylyov
` (8 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: fa3364b5a2d7 ("USB: OHCI: Add a generic platform device driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-platform.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 4a8456f12a73..ec1d38d5d140 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -113,6 +113,8 @@ static int ohci_platform_probe(struct platform_device *dev)
irq = platform_get_irq(dev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
hcd = usb_create_hcd(&ohci_platform_hc_driver, &dev->dev,
dev_name(&dev->dev));
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 14/22] usb: host: ohci-pxa27x: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (12 preceding siblings ...)
2021-10-26 17:39 ` [PATCH v2 13/22] usb: host: ohci-platform: " Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 15/22] usb: host: ohci-sm501: " Sergey Shtylyov
` (7 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 84bab7393b0d ("[ARM] ohci-pxa27x: use platform_get_{irq,resource} for the resource")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-pxa27x.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 54aa5c77e549..336437277fd0 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -443,6 +443,8 @@ static int ohci_hcd_pxa27x_probe(struct platform_device *pdev)
pr_err("no resource of IORESOURCE_IRQ");
return irq;
}
+ if (!irq)
+ return -EINVAL;
usb_clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(usb_clk))
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 15/22] usb: host: ohci-sm501: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (13 preceding siblings ...)
2021-10-26 17:39 ` [PATCH v2 14/22] usb: host: ohci-pxa27x: " Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 16/22] usb: host: ohci-spear: " Sergey Shtylyov
` (6 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: f54aab6ebcec ("usb: ohci-sm501 driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-sm501.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index b91d50da6127..ffb7b6645d2c 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -96,6 +96,10 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
irq = retval = platform_get_irq(pdev, 0);
if (retval < 0)
goto err0;
+ if (!retval) {
+ retval = -EINVAL;
+ goto err0;
+ }
mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (mem == NULL) {
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 16/22] usb: host: ohci-spear: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (14 preceding siblings ...)
2021-10-26 17:39 ` [PATCH v2 15/22] usb: host: ohci-sm501: " Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
` (5 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: c8c38de9d800 ("USB host: Adding USB ehci & ohci support for spear platform")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-spear.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index b4cd9e6c72fd..6c5af2612c46 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -46,6 +46,10 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev)
retval = irq;
goto fail;
}
+ if (!irq) {
+ retval = -EINVAL;
+ goto fail;
+ }
/*
* Right now device-tree probed devices don't get dma_mask set.
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 17/22] usb: host: ohci-st: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 02/22] usb: host: ehci-mv: " Sergey Shtylyov
` (20 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Patrice Chotard, linux-arm-kernel
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: d115837259ad ("usb: host: ohci-st: Add OHCI driver support for ST STB devices")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-st.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ohci-st.c b/drivers/usb/host/ohci-st.c
index ac796ccd93ef..b9200071ce6c 100644
--- a/drivers/usb/host/ohci-st.c
+++ b/drivers/usb/host/ohci-st.c
@@ -140,6 +140,8 @@ static int st_ohci_platform_probe(struct platform_device *dev)
irq = platform_get_irq(dev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!res_mem) {
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 17/22] usb: host: ohci-st: deny IRQ0
@ 2021-10-26 17:39 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Patrice Chotard, linux-arm-kernel
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: d115837259ad ("usb: host: ohci-st: Add OHCI driver support for ST STB devices")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-st.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ohci-st.c b/drivers/usb/host/ohci-st.c
index ac796ccd93ef..b9200071ce6c 100644
--- a/drivers/usb/host/ohci-st.c
+++ b/drivers/usb/host/ohci-st.c
@@ -140,6 +140,8 @@ static int st_ohci_platform_probe(struct platform_device *dev)
irq = platform_get_irq(dev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!res_mem) {
--
2.26.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 18/22] usb: host: ohci-tmio: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (16 preceding siblings ...)
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 19/22] usb: host: xhci-histb: " Sergey Shtylyov
` (3 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 78c73414f4f6 ("USB: ohci: add support for tmio-ohci cell")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.
drivers/usb/host/ohci-tmio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
index 08ec2ab0d95a..53932e8a968f 100644
--- a/drivers/usb/host/ohci-tmio.c
+++ b/drivers/usb/host/ohci-tmio.c
@@ -204,6 +204,8 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
hcd = usb_create_hcd(&ohci_tmio_hc_driver, &dev->dev, dev_name(&dev->dev));
if (!hcd) {
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 19/22] usb: host: xhci-histb: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (17 preceding siblings ...)
2021-10-26 17:39 ` [PATCH v2 18/22] usb: host: ohci-tmio: " Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
` (2 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Mathias Nyman, Greg Kroah-Hartman
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: c508f41da078 ("xhci: hisilicon: support HiSilicon STB xHCI host controller")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/usb/host/xhci-histb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/xhci-histb.c b/drivers/usb/host/xhci-histb.c
index 08369857686e..581952dcefe8 100644
--- a/drivers/usb/host/xhci-histb.c
+++ b/drivers/usb/host/xhci-histb.c
@@ -218,6 +218,8 @@ static int xhci_histb_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
histb->ctrl = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(histb->ctrl))
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
` (19 subsequent siblings)
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Chunfeng Yun, Matthias Brugger, linux-arm-kernel, linux-mediatek
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/usb/host/xhci-mtk.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index c53f6f276d5c..d2dc8d9863ee 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)
return ret;
irq = platform_get_irq_byname_optional(pdev, "host");
- if (irq < 0) {
+ if (irq <= 0) {
if (irq == -EPROBE_DEFER)
return irq;
@@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
}
wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
@ 2021-10-26 17:39 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Chunfeng Yun, Matthias Brugger, linux-arm-kernel, linux-mediatek
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/usb/host/xhci-mtk.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index c53f6f276d5c..d2dc8d9863ee 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)
return ret;
irq = platform_get_irq_byname_optional(pdev, "host");
- if (irq < 0) {
+ if (irq <= 0) {
if (irq == -EPROBE_DEFER)
return irq;
@@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
}
wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
--
2.26.3
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
@ 2021-10-26 17:39 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Chunfeng Yun, Matthias Brugger, linux-arm-kernel, linux-mediatek
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/usb/host/xhci-mtk.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index c53f6f276d5c..d2dc8d9863ee 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)
return ret;
irq = platform_get_irq_byname_optional(pdev, "host");
- if (irq < 0) {
+ if (irq <= 0) {
if (irq == -EPROBE_DEFER)
return irq;
@@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
}
wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
--
2.26.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 21/22] usb: host: xhci-plat: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (19 preceding siblings ...)
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 22/22] usb: host: xhci-tegra: " Sergey Shtylyov
21 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: 3429e91a661e ("usb: host: xhci: add platform driver support")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/usb/host/xhci-plat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index c1edcc9b13ce..8f8ad82d90cd 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -205,6 +205,8 @@ static int xhci_plat_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
+ if (!irq)
+ return -EINVAL;
/*
* sysdev must point to a device that is known to the system firmware
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 22/22] usb: host: xhci-tegra: deny IRQ0
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
` (20 preceding siblings ...)
2021-10-26 17:39 ` [PATCH v2 21/22] usb: host: xhci-plat: " Sergey Shtylyov
@ 2021-10-26 17:39 ` Sergey Shtylyov
2021-10-30 22:08 ` kernel test robot
21 siblings, 1 reply; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-26 17:39 UTC (permalink / raw)
To: linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: Thierry Reding, Jonathan Hunter, linux-tegra
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
Fixes: e84fce0f8837 ("usb: xhci: Add NVIDIA Tegra XUSB controller driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/usb/host/xhci-tegra.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 1bf494b649bd..7151b1d4f876 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -1439,6 +1439,8 @@ static int tegra_xusb_probe(struct platform_device *pdev)
tegra->xhci_irq = platform_get_irq(pdev, 0);
if (tegra->xhci_irq < 0)
return tegra->xhci_irq;
+ if (!tegra->xhci_irq)
+ return -ENIVAL;
tegra->mbox_irq = platform_get_irq(pdev, 1);
if (tegra->mbox_irq < 0)
--
2.26.3
^ permalink raw reply related [flat|nested] 63+ messages in thread
* Re: [PATCH v2 11/22] usb: host: ohci-nxp: deny IRQ0
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-26 18:25 ` Vladimir Zapolskiy
-1 siblings, 0 replies; 63+ messages in thread
From: Vladimir Zapolskiy @ 2021-10-26 18:25 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: linux-arm-kernel
Hi Sergey,
On 10/26/21 8:39 PM, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>
> Fixes: 60bbfc84b6d9 ("USB OHCI controller support for PNX4008")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
> Changes in version 2:
> - fixed the subject to match the patch;
> - added Alan's ACK.
>
> drivers/usb/host/ohci-nxp.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
> index 85878e8ad331..afb9c2fc85c3 100644
> --- a/drivers/usb/host/ohci-nxp.c
> +++ b/drivers/usb/host/ohci-nxp.c
> @@ -215,6 +215,10 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
> ret = -ENXIO;
> goto fail_resource;
> }
> + if (!irq) {
> + ret = -EINVAL;
> + goto fail_resource;
> + }
>
> ohci_nxp_start_hc();
> platform_set_drvdata(pdev, hcd);
>
thank you for the change.
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
--
Best wishes,
Vladimir
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 11/22] usb: host: ohci-nxp: deny IRQ0
@ 2021-10-26 18:25 ` Vladimir Zapolskiy
0 siblings, 0 replies; 63+ messages in thread
From: Vladimir Zapolskiy @ 2021-10-26 18:25 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: linux-arm-kernel
Hi Sergey,
On 10/26/21 8:39 PM, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>
> Fixes: 60bbfc84b6d9 ("USB OHCI controller support for PNX4008")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
> Changes in version 2:
> - fixed the subject to match the patch;
> - added Alan's ACK.
>
> drivers/usb/host/ohci-nxp.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
> index 85878e8ad331..afb9c2fc85c3 100644
> --- a/drivers/usb/host/ohci-nxp.c
> +++ b/drivers/usb/host/ohci-nxp.c
> @@ -215,6 +215,10 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
> ret = -ENXIO;
> goto fail_resource;
> }
> + if (!irq) {
> + ret = -EINVAL;
> + goto fail_resource;
> + }
>
> ohci_nxp_start_hc();
> platform_set_drvdata(pdev, hcd);
>
thank you for the change.
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
--
Best wishes,
Vladimir
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 07/22] usb: host: ehci-st: deny IRQ0
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-27 6:08 ` Patrice CHOTARD
-1 siblings, 0 replies; 63+ messages in thread
From: Patrice CHOTARD @ 2021-10-27 6:08 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: linux-arm-kernel
Hi Sergey
On 10/26/21 7:39 PM, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>
> Fixes: e47c5a0906f9 ("usb: host: ehci-st: Add EHCI support for ST STB devices")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
> Changes in version 2:
> - added Alan's ACK.
>
> drivers/usb/host/ehci-st.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/host/ehci-st.c b/drivers/usb/host/ehci-st.c
> index f74433aac948..5f53c313f943 100644
> --- a/drivers/usb/host/ehci-st.c
> +++ b/drivers/usb/host/ehci-st.c
> @@ -160,6 +160,8 @@ static int st_ehci_platform_probe(struct platform_device *dev)
> irq = platform_get_irq(dev, 0);
> if (irq < 0)
> return irq;
> + if (!irq)
> + return -EINVAL;
> res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
> if (!res_mem) {
> dev_err(&dev->dev, "no memory resource provided");
>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 07/22] usb: host: ehci-st: deny IRQ0
@ 2021-10-27 6:08 ` Patrice CHOTARD
0 siblings, 0 replies; 63+ messages in thread
From: Patrice CHOTARD @ 2021-10-27 6:08 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: linux-arm-kernel
Hi Sergey
On 10/26/21 7:39 PM, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>
> Fixes: e47c5a0906f9 ("usb: host: ehci-st: Add EHCI support for ST STB devices")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
> Changes in version 2:
> - added Alan's ACK.
>
> drivers/usb/host/ehci-st.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/host/ehci-st.c b/drivers/usb/host/ehci-st.c
> index f74433aac948..5f53c313f943 100644
> --- a/drivers/usb/host/ehci-st.c
> +++ b/drivers/usb/host/ehci-st.c
> @@ -160,6 +160,8 @@ static int st_ehci_platform_probe(struct platform_device *dev)
> irq = platform_get_irq(dev, 0);
> if (irq < 0)
> return irq;
> + if (!irq)
> + return -EINVAL;
> res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
> if (!res_mem) {
> dev_err(&dev->dev, "no memory resource provided");
>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 17/22] usb: host: ohci-st: deny IRQ0
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-27 6:08 ` Patrice CHOTARD
-1 siblings, 0 replies; 63+ messages in thread
From: Patrice CHOTARD @ 2021-10-27 6:08 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: linux-arm-kernel
Hi Sergey
On 10/26/21 7:39 PM, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>
> Fixes: d115837259ad ("usb: host: ohci-st: Add OHCI driver support for ST STB devices")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
> Changes in version 2:
> - added Alan's ACK.
>
> drivers/usb/host/ohci-st.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/host/ohci-st.c b/drivers/usb/host/ohci-st.c
> index ac796ccd93ef..b9200071ce6c 100644
> --- a/drivers/usb/host/ohci-st.c
> +++ b/drivers/usb/host/ohci-st.c
> @@ -140,6 +140,8 @@ static int st_ohci_platform_probe(struct platform_device *dev)
> irq = platform_get_irq(dev, 0);
> if (irq < 0)
> return irq;
> + if (!irq)
> + return -EINVAL;
>
> res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
> if (!res_mem) {
>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 17/22] usb: host: ohci-st: deny IRQ0
@ 2021-10-27 6:08 ` Patrice CHOTARD
0 siblings, 0 replies; 63+ messages in thread
From: Patrice CHOTARD @ 2021-10-27 6:08 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: linux-arm-kernel
Hi Sergey
On 10/26/21 7:39 PM, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>
> Fixes: d115837259ad ("usb: host: ohci-st: Add OHCI driver support for ST STB devices")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
> Changes in version 2:
> - added Alan's ACK.
>
> drivers/usb/host/ohci-st.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/host/ohci-st.c b/drivers/usb/host/ohci-st.c
> index ac796ccd93ef..b9200071ce6c 100644
> --- a/drivers/usb/host/ohci-st.c
> +++ b/drivers/usb/host/ohci-st.c
> @@ -140,6 +140,8 @@ static int st_ohci_platform_probe(struct platform_device *dev)
> irq = platform_get_irq(dev, 0);
> if (irq < 0)
> return irq;
> + if (!irq)
> + return -EINVAL;
>
> res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
> if (!res_mem) {
>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
2021-10-26 17:39 ` Sergey Shtylyov
(?)
@ 2021-10-27 8:54 ` Chunfeng Yun
-1 siblings, 0 replies; 63+ messages in thread
From: Chunfeng Yun @ 2021-10-27 8:54 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On Tue, 2021-10-26 at 20:39 +0300, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to
> Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no
> IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe()
> method...
>
> Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
> controller")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
> drivers/usb/host/xhci-mtk.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
> mtk.c
> index c53f6f276d5c..d2dc8d9863ee 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> return ret;
>
> irq = platform_get_irq_byname_optional(pdev, "host");
> - if (irq < 0) {
> + if (irq <= 0) {
> if (irq == -EPROBE_DEFER)
> return irq;
>
> @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> return irq;
> + if (!irq)
It is "if (irq <= 0)"?
> + return -EINVAL;
> }
>
> wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
@ 2021-10-27 8:54 ` Chunfeng Yun
0 siblings, 0 replies; 63+ messages in thread
From: Chunfeng Yun @ 2021-10-27 8:54 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On Tue, 2021-10-26 at 20:39 +0300, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to
> Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no
> IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe()
> method...
>
> Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
> controller")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
> drivers/usb/host/xhci-mtk.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
> mtk.c
> index c53f6f276d5c..d2dc8d9863ee 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> return ret;
>
> irq = platform_get_irq_byname_optional(pdev, "host");
> - if (irq < 0) {
> + if (irq <= 0) {
> if (irq == -EPROBE_DEFER)
> return irq;
>
> @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> return irq;
> + if (!irq)
It is "if (irq <= 0)"?
> + return -EINVAL;
> }
>
> wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
@ 2021-10-27 8:54 ` Chunfeng Yun
0 siblings, 0 replies; 63+ messages in thread
From: Chunfeng Yun @ 2021-10-27 8:54 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On Tue, 2021-10-26 at 20:39 +0300, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to
> Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no
> IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe()
> method...
>
> Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
> controller")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
> drivers/usb/host/xhci-mtk.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
> mtk.c
> index c53f6f276d5c..d2dc8d9863ee 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> return ret;
>
> irq = platform_get_irq_byname_optional(pdev, "host");
> - if (irq < 0) {
> + if (irq <= 0) {
> if (irq == -EPROBE_DEFER)
> return irq;
>
> @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> return irq;
> + if (!irq)
It is "if (irq <= 0)"?
> + return -EINVAL;
> }
>
> wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
2021-10-26 17:39 ` Sergey Shtylyov
(?)
@ 2021-10-27 9:18 ` Chunfeng Yun
-1 siblings, 0 replies; 63+ messages in thread
From: Chunfeng Yun @ 2021-10-27 9:18 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On Tue, 2021-10-26 at 20:39 +0300, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to
> Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no
> IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe()
> method...
>
> Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
> controller")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
> drivers/usb/host/xhci-mtk.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
> mtk.c
> index c53f6f276d5c..d2dc8d9863ee 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> return ret;
>
> irq = platform_get_irq_byname_optional(pdev, "host");
> - if (irq < 0) {
> + if (irq <= 0) {
> if (irq == -EPROBE_DEFER)
> return irq;
>
> @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> return irq;
> + if (!irq)
it's "if (irq <= 0)"?
> + return -EINVAL;
> }
>
> wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
@ 2021-10-27 9:18 ` Chunfeng Yun
0 siblings, 0 replies; 63+ messages in thread
From: Chunfeng Yun @ 2021-10-27 9:18 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On Tue, 2021-10-26 at 20:39 +0300, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to
> Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no
> IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe()
> method...
>
> Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
> controller")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
> drivers/usb/host/xhci-mtk.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
> mtk.c
> index c53f6f276d5c..d2dc8d9863ee 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> return ret;
>
> irq = platform_get_irq_byname_optional(pdev, "host");
> - if (irq < 0) {
> + if (irq <= 0) {
> if (irq == -EPROBE_DEFER)
> return irq;
>
> @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> return irq;
> + if (!irq)
it's "if (irq <= 0)"?
> + return -EINVAL;
> }
>
> wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
@ 2021-10-27 9:18 ` Chunfeng Yun
0 siblings, 0 replies; 63+ messages in thread
From: Chunfeng Yun @ 2021-10-27 9:18 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On Tue, 2021-10-26 at 20:39 +0300, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to
> Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no
> IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe()
> method...
>
> Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
> controller")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
> drivers/usb/host/xhci-mtk.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
> mtk.c
> index c53f6f276d5c..d2dc8d9863ee 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> return ret;
>
> irq = platform_get_irq_byname_optional(pdev, "host");
> - if (irq < 0) {
> + if (irq <= 0) {
> if (irq == -EPROBE_DEFER)
> return irq;
>
> @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device
> *pdev)
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> return irq;
> + if (!irq)
it's "if (irq <= 0)"?
> + return -EINVAL;
> }
>
> wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
2021-10-27 9:18 ` Chunfeng Yun
(?)
@ 2021-10-27 9:25 ` Sergey Shtylyov
-1 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-27 9:25 UTC (permalink / raw)
To: Chunfeng Yun, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On 27.10.2021 12:18, Chunfeng Yun wrote:
>> If platform_get_irq() returns IRQ0 (considered invalid according to
>> Linus)
>> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no
>> IRQ
>> at all. Deny IRQ0 right away, returning -EINVAL from the probe()
>> method...
>>
>> Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
>> controller")
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>> ---
>> drivers/usb/host/xhci-mtk.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
>> mtk.c
>> index c53f6f276d5c..d2dc8d9863ee 100644
>> --- a/drivers/usb/host/xhci-mtk.c
>> +++ b/drivers/usb/host/xhci-mtk.c
>> @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device
>> *pdev)
>> return ret;
>>
>> irq = platform_get_irq_byname_optional(pdev, "host");
>> - if (irq < 0) {
>> + if (irq <= 0) {
>> if (irq == -EPROBE_DEFER)
>> return irq;
>>
>> @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device
>> *pdev)
>> irq = platform_get_irq(pdev, 0);
>> if (irq < 0)
>> return irq;
>> + if (!irq)
> it's "if (irq <= 0)"?
No, if (irq == 0).
>> + return -EINVAL;
>> }
>>
>> wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
MBR, Sergey
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
@ 2021-10-27 9:25 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-27 9:25 UTC (permalink / raw)
To: Chunfeng Yun, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On 27.10.2021 12:18, Chunfeng Yun wrote:
>> If platform_get_irq() returns IRQ0 (considered invalid according to
>> Linus)
>> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no
>> IRQ
>> at all. Deny IRQ0 right away, returning -EINVAL from the probe()
>> method...
>>
>> Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
>> controller")
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>> ---
>> drivers/usb/host/xhci-mtk.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
>> mtk.c
>> index c53f6f276d5c..d2dc8d9863ee 100644
>> --- a/drivers/usb/host/xhci-mtk.c
>> +++ b/drivers/usb/host/xhci-mtk.c
>> @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device
>> *pdev)
>> return ret;
>>
>> irq = platform_get_irq_byname_optional(pdev, "host");
>> - if (irq < 0) {
>> + if (irq <= 0) {
>> if (irq == -EPROBE_DEFER)
>> return irq;
>>
>> @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device
>> *pdev)
>> irq = platform_get_irq(pdev, 0);
>> if (irq < 0)
>> return irq;
>> + if (!irq)
> it's "if (irq <= 0)"?
No, if (irq == 0).
>> + return -EINVAL;
>> }
>>
>> wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
MBR, Sergey
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
@ 2021-10-27 9:25 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-10-27 9:25 UTC (permalink / raw)
To: Chunfeng Yun, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On 27.10.2021 12:18, Chunfeng Yun wrote:
>> If platform_get_irq() returns IRQ0 (considered invalid according to
>> Linus)
>> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no
>> IRQ
>> at all. Deny IRQ0 right away, returning -EINVAL from the probe()
>> method...
>>
>> Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
>> controller")
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>> ---
>> drivers/usb/host/xhci-mtk.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
>> mtk.c
>> index c53f6f276d5c..d2dc8d9863ee 100644
>> --- a/drivers/usb/host/xhci-mtk.c
>> +++ b/drivers/usb/host/xhci-mtk.c
>> @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct platform_device
>> *pdev)
>> return ret;
>>
>> irq = platform_get_irq_byname_optional(pdev, "host");
>> - if (irq < 0) {
>> + if (irq <= 0) {
>> if (irq == -EPROBE_DEFER)
>> return irq;
>>
>> @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct platform_device
>> *pdev)
>> irq = platform_get_irq(pdev, 0);
>> if (irq < 0)
>> return irq;
>> + if (!irq)
> it's "if (irq <= 0)"?
No, if (irq == 0).
>> + return -EINVAL;
>> }
>>
>> wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup");
MBR, Sergey
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
2021-10-27 9:25 ` Sergey Shtylyov
(?)
@ 2021-10-27 9:35 ` Chunfeng Yun
-1 siblings, 0 replies; 63+ messages in thread
From: Chunfeng Yun @ 2021-10-27 9:35 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On Wed, 2021-10-27 at 12:25 +0300, Sergey Shtylyov wrote:
> On 27.10.2021 12:18, Chunfeng Yun wrote:
>
> > > If platform_get_irq() returns IRQ0 (considered invalid according
> > > to
> > > Linus)
> > > the driver blithely passes it to usb_add_hcd() that treats IRQ0
> > > as no
> > > IRQ
> > > at all. Deny IRQ0 right away, returning -EINVAL from the probe()
> > > method...
> > >
> > > Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
> > > controller")
> > > Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> > > ---
> > > drivers/usb/host/xhci-mtk.c | 4 +++-
> > > 1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
> > > mtk.c
> > > index c53f6f276d5c..d2dc8d9863ee 100644
> > > --- a/drivers/usb/host/xhci-mtk.c
> > > +++ b/drivers/usb/host/xhci-mtk.c
> > > @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct
> > > platform_device
> > > *pdev)
> > > return ret;
> > >
> > > irq = platform_get_irq_byname_optional(pdev, "host");
> > > - if (irq < 0) {
> > > + if (irq <= 0) {
> > > if (irq == -EPROBE_DEFER)
> > > return irq;
> > >
> > > @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct
> > > platform_device
> > > *pdev)
> > > irq = platform_get_irq(pdev, 0);
Here, irq is updated again
> > > if (irq < 0)
> > > return irq;
> > > + if (!irq)
> >
> > it's "if (irq <= 0)"?
>
> No, if (irq == 0).
>
> > > + return -EINVAL;
add "else if (irq < 0), return irq;"? but not -EINVAL only, this may
drop EPROBE_DEFER
> > > }
> > >
> > > wakeup_irq = platform_get_irq_byname_optional(pdev,
> > > "wakeup");
>
> MBR, Sergey
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
@ 2021-10-27 9:35 ` Chunfeng Yun
0 siblings, 0 replies; 63+ messages in thread
From: Chunfeng Yun @ 2021-10-27 9:35 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On Wed, 2021-10-27 at 12:25 +0300, Sergey Shtylyov wrote:
> On 27.10.2021 12:18, Chunfeng Yun wrote:
>
> > > If platform_get_irq() returns IRQ0 (considered invalid according
> > > to
> > > Linus)
> > > the driver blithely passes it to usb_add_hcd() that treats IRQ0
> > > as no
> > > IRQ
> > > at all. Deny IRQ0 right away, returning -EINVAL from the probe()
> > > method...
> > >
> > > Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
> > > controller")
> > > Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> > > ---
> > > drivers/usb/host/xhci-mtk.c | 4 +++-
> > > 1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
> > > mtk.c
> > > index c53f6f276d5c..d2dc8d9863ee 100644
> > > --- a/drivers/usb/host/xhci-mtk.c
> > > +++ b/drivers/usb/host/xhci-mtk.c
> > > @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct
> > > platform_device
> > > *pdev)
> > > return ret;
> > >
> > > irq = platform_get_irq_byname_optional(pdev, "host");
> > > - if (irq < 0) {
> > > + if (irq <= 0) {
> > > if (irq == -EPROBE_DEFER)
> > > return irq;
> > >
> > > @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct
> > > platform_device
> > > *pdev)
> > > irq = platform_get_irq(pdev, 0);
Here, irq is updated again
> > > if (irq < 0)
> > > return irq;
> > > + if (!irq)
> >
> > it's "if (irq <= 0)"?
>
> No, if (irq == 0).
>
> > > + return -EINVAL;
add "else if (irq < 0), return irq;"? but not -EINVAL only, this may
drop EPROBE_DEFER
> > > }
> > >
> > > wakeup_irq = platform_get_irq_byname_optional(pdev,
> > > "wakeup");
>
> MBR, Sergey
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0
@ 2021-10-27 9:35 ` Chunfeng Yun
0 siblings, 0 replies; 63+ messages in thread
From: Chunfeng Yun @ 2021-10-27 9:35 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Mathias Nyman, Greg Kroah-Hartman
Cc: Matthias Brugger, linux-arm-kernel, linux-mediatek
On Wed, 2021-10-27 at 12:25 +0300, Sergey Shtylyov wrote:
> On 27.10.2021 12:18, Chunfeng Yun wrote:
>
> > > If platform_get_irq() returns IRQ0 (considered invalid according
> > > to
> > > Linus)
> > > the driver blithely passes it to usb_add_hcd() that treats IRQ0
> > > as no
> > > IRQ
> > > at all. Deny IRQ0 right away, returning -EINVAL from the probe()
> > > method...
> > >
> > > Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host
> > > controller")
> > > Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> > > ---
> > > drivers/usb/host/xhci-mtk.c | 4 +++-
> > > 1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-
> > > mtk.c
> > > index c53f6f276d5c..d2dc8d9863ee 100644
> > > --- a/drivers/usb/host/xhci-mtk.c
> > > +++ b/drivers/usb/host/xhci-mtk.c
> > > @@ -495,7 +495,7 @@ static int xhci_mtk_probe(struct
> > > platform_device
> > > *pdev)
> > > return ret;
> > >
> > > irq = platform_get_irq_byname_optional(pdev, "host");
> > > - if (irq < 0) {
> > > + if (irq <= 0) {
> > > if (irq == -EPROBE_DEFER)
> > > return irq;
> > >
> > > @@ -503,6 +503,8 @@ static int xhci_mtk_probe(struct
> > > platform_device
> > > *pdev)
> > > irq = platform_get_irq(pdev, 0);
Here, irq is updated again
> > > if (irq < 0)
> > > return irq;
> > > + if (!irq)
> >
> > it's "if (irq <= 0)"?
>
> No, if (irq == 0).
>
> > > + return -EINVAL;
add "else if (irq < 0), return irq;"? but not -EINVAL only, this may
drop EPROBE_DEFER
> > > }
> > >
> > > wakeup_irq = platform_get_irq_byname_optional(pdev,
> > > "wakeup");
>
> MBR, Sergey
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
2021-10-26 17:39 ` Sergey Shtylyov
@ 2021-10-30 8:54 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 63+ messages in thread
From: Greg Kroah-Hartman @ 2021-10-30 8:54 UTC (permalink / raw)
To: Sergey Shtylyov
Cc: linux-usb, Alan Stern, Krzysztof Kozlowski, linux-arm-kernel,
linux-samsung-soc
On Tue, Oct 26, 2021 at 08:39:22PM +0300, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>
> Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
> Changes in version 2:
> - added Alan's ACK.
>
> drivers/usb/host/ehci-exynos.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
> index 1a9b7572e17f..ff4e1261801a 100644
> --- a/drivers/usb/host/ehci-exynos.c
> +++ b/drivers/usb/host/ehci-exynos.c
> @@ -207,6 +207,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
> err = irq;
> goto fail_io;
> }
> + if (!irq) {
> + err = -EINVAL;
> + goto fail_io;
> + }
This is a huge sign that the api being used here is broken.
Please fix the root cause here, if returning a 0 is an error, then have
the function you called to get this irq return an error. Otherwise you
will have to fix ALL callers, and people will always get it wrong.
Fix the root cause here, don't paper it over.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
@ 2021-10-30 8:54 ` Greg Kroah-Hartman
0 siblings, 0 replies; 63+ messages in thread
From: Greg Kroah-Hartman @ 2021-10-30 8:54 UTC (permalink / raw)
To: Sergey Shtylyov
Cc: linux-usb, Alan Stern, Krzysztof Kozlowski, linux-arm-kernel,
linux-samsung-soc
On Tue, Oct 26, 2021 at 08:39:22PM +0300, Sergey Shtylyov wrote:
> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>
> Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
> Changes in version 2:
> - added Alan's ACK.
>
> drivers/usb/host/ehci-exynos.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
> index 1a9b7572e17f..ff4e1261801a 100644
> --- a/drivers/usb/host/ehci-exynos.c
> +++ b/drivers/usb/host/ehci-exynos.c
> @@ -207,6 +207,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
> err = irq;
> goto fail_io;
> }
> + if (!irq) {
> + err = -EINVAL;
> + goto fail_io;
> + }
This is a huge sign that the api being used here is broken.
Please fix the root cause here, if returning a 0 is an error, then have
the function you called to get this irq return an error. Otherwise you
will have to fix ALL callers, and people will always get it wrong.
Fix the root cause here, don't paper it over.
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 04/22] usb: host: ehci-omap: deny IRQ0
2021-10-26 17:39 ` [PATCH v2 04/22] usb: host: ehci-omap: " Sergey Shtylyov
@ 2021-10-30 19:49 ` kernel test robot
0 siblings, 0 replies; 63+ messages in thread
From: kernel test robot @ 2021-10-30 19:49 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: kbuild-all, linux-omap
[-- Attachment #1: Type: text/plain, Size: 7101 bytes --]
Hi Sergey,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on peter-chen-usb/for-usb-next balbi-usb/testing/next v5.15-rc7 next-20211029]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Sergey-Shtylyov/Explicitly-deny-IRQ0-in-the-USB-host-drivers/20211027-015925
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/99339edc4591ee2104acf45913d0dcb2a75bf1bf
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sergey-Shtylyov/Explicitly-deny-IRQ0-in-the-USB-host-drivers/20211027-015925
git checkout 99339edc4591ee2104acf45913d0dcb2a75bf1bf
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/usb/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/usb/host/ehci-omap.c: In function 'ehci_hcd_omap_probe':
>> drivers/usb/host/ehci-omap.c:121:25: error: 'ENIVAL' undeclared (first use in this function); did you mean 'EINVAL'?
121 | return -ENIVAL;
| ^~~~~~
| EINVAL
drivers/usb/host/ehci-omap.c:121:25: note: each undeclared identifier is reported only once for each function it appears in
vim +121 drivers/usb/host/ehci-omap.c
77
78 /**
79 * ehci_hcd_omap_probe - initialize TI-based HCDs
80 * @pdev: Pointer to this platform device's information
81 *
82 * Allocates basic resources for this USB host controller, and
83 * then invokes the start() method for the HCD associated with it
84 * through the hotplug entry's driver_data.
85 */
86 static int ehci_hcd_omap_probe(struct platform_device *pdev)
87 {
88 struct device *dev = &pdev->dev;
89 struct usbhs_omap_platform_data *pdata = dev_get_platdata(dev);
90 struct resource *res;
91 struct usb_hcd *hcd;
92 void __iomem *regs;
93 int ret;
94 int irq;
95 int i;
96 struct omap_hcd *omap;
97
98 if (usb_disabled())
99 return -ENODEV;
100
101 if (!dev->parent) {
102 dev_err(dev, "Missing parent device\n");
103 return -ENODEV;
104 }
105
106 /* For DT boot, get platform data from parent. i.e. usbhshost */
107 if (dev->of_node) {
108 pdata = dev_get_platdata(dev->parent);
109 dev->platform_data = pdata;
110 }
111
112 if (!pdata) {
113 dev_err(dev, "Missing platform data\n");
114 return -ENODEV;
115 }
116
117 irq = platform_get_irq(pdev, 0);
118 if (irq < 0)
119 return irq;
120 if (!irq)
> 121 return -ENIVAL;
122
123 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
124 regs = devm_ioremap_resource(dev, res);
125 if (IS_ERR(regs))
126 return PTR_ERR(regs);
127
128 /*
129 * Right now device-tree probed devices don't get dma_mask set.
130 * Since shared usb code relies on it, set it here for now.
131 * Once we have dma capability bindings this can go away.
132 */
133 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
134 if (ret)
135 return ret;
136
137 ret = -ENODEV;
138 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev,
139 dev_name(dev));
140 if (!hcd) {
141 dev_err(dev, "Failed to create HCD\n");
142 return -ENOMEM;
143 }
144
145 hcd->rsrc_start = res->start;
146 hcd->rsrc_len = resource_size(res);
147 hcd->regs = regs;
148 hcd_to_ehci(hcd)->caps = regs;
149
150 omap = (struct omap_hcd *)hcd_to_ehci(hcd)->priv;
151 omap->nports = pdata->nports;
152
153 platform_set_drvdata(pdev, hcd);
154
155 /* get the PHY devices if needed */
156 for (i = 0 ; i < omap->nports ; i++) {
157 struct usb_phy *phy;
158
159 /* get the PHY device */
160 phy = devm_usb_get_phy_by_phandle(dev, "phys", i);
161 if (IS_ERR(phy)) {
162 ret = PTR_ERR(phy);
163 if (ret == -ENODEV) { /* no PHY */
164 phy = NULL;
165 continue;
166 }
167
168 if (ret != -EPROBE_DEFER)
169 dev_err(dev, "Can't get PHY for port %d: %d\n",
170 i, ret);
171 goto err_phy;
172 }
173
174 omap->phy[i] = phy;
175
176 if (pdata->port_mode[i] == OMAP_EHCI_PORT_MODE_PHY) {
177 usb_phy_init(omap->phy[i]);
178 /* bring PHY out of suspend */
179 usb_phy_set_suspend(omap->phy[i], 0);
180 }
181 }
182
183 pm_runtime_enable(dev);
184 pm_runtime_get_sync(dev);
185
186 /*
187 * An undocumented "feature" in the OMAP3 EHCI controller,
188 * causes suspended ports to be taken out of suspend when
189 * the USBCMD.Run/Stop bit is cleared (for example when
190 * we do ehci_bus_suspend).
191 * This breaks suspend-resume if the root-hub is allowed
192 * to suspend. Writing 1 to this undocumented register bit
193 * disables this feature and restores normal behavior.
194 */
195 ehci_write(regs, EHCI_INSNREG04,
196 EHCI_INSNREG04_DISABLE_UNSUSPEND);
197
198 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
199 if (ret) {
200 dev_err(dev, "failed to add hcd with err %d\n", ret);
201 goto err_pm_runtime;
202 }
203 device_wakeup_enable(hcd->self.controller);
204
205 /*
206 * Bring PHYs out of reset for non PHY modes.
207 * Even though HSIC mode is a PHY-less mode, the reset
208 * line exists between the chips and can be modelled
209 * as a PHY device for reset control.
210 */
211 for (i = 0; i < omap->nports; i++) {
212 if (!omap->phy[i] ||
213 pdata->port_mode[i] == OMAP_EHCI_PORT_MODE_PHY)
214 continue;
215
216 usb_phy_init(omap->phy[i]);
217 /* bring PHY out of suspend */
218 usb_phy_set_suspend(omap->phy[i], 0);
219 }
220
221 return 0;
222
223 err_pm_runtime:
224 pm_runtime_put_sync(dev);
225 pm_runtime_disable(dev);
226
227 err_phy:
228 for (i = 0; i < omap->nports; i++) {
229 if (omap->phy[i])
230 usb_phy_shutdown(omap->phy[i]);
231 }
232
233 usb_put_hcd(hcd);
234
235 return ret;
236 }
237
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 55370 bytes --]
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 04/22] usb: host: ehci-omap: deny IRQ0
@ 2021-10-30 19:49 ` kernel test robot
0 siblings, 0 replies; 63+ messages in thread
From: kernel test robot @ 2021-10-30 19:49 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7308 bytes --]
Hi Sergey,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on peter-chen-usb/for-usb-next balbi-usb/testing/next v5.15-rc7 next-20211029]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Sergey-Shtylyov/Explicitly-deny-IRQ0-in-the-USB-host-drivers/20211027-015925
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/99339edc4591ee2104acf45913d0dcb2a75bf1bf
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sergey-Shtylyov/Explicitly-deny-IRQ0-in-the-USB-host-drivers/20211027-015925
git checkout 99339edc4591ee2104acf45913d0dcb2a75bf1bf
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/usb/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/usb/host/ehci-omap.c: In function 'ehci_hcd_omap_probe':
>> drivers/usb/host/ehci-omap.c:121:25: error: 'ENIVAL' undeclared (first use in this function); did you mean 'EINVAL'?
121 | return -ENIVAL;
| ^~~~~~
| EINVAL
drivers/usb/host/ehci-omap.c:121:25: note: each undeclared identifier is reported only once for each function it appears in
vim +121 drivers/usb/host/ehci-omap.c
77
78 /**
79 * ehci_hcd_omap_probe - initialize TI-based HCDs
80 * @pdev: Pointer to this platform device's information
81 *
82 * Allocates basic resources for this USB host controller, and
83 * then invokes the start() method for the HCD associated with it
84 * through the hotplug entry's driver_data.
85 */
86 static int ehci_hcd_omap_probe(struct platform_device *pdev)
87 {
88 struct device *dev = &pdev->dev;
89 struct usbhs_omap_platform_data *pdata = dev_get_platdata(dev);
90 struct resource *res;
91 struct usb_hcd *hcd;
92 void __iomem *regs;
93 int ret;
94 int irq;
95 int i;
96 struct omap_hcd *omap;
97
98 if (usb_disabled())
99 return -ENODEV;
100
101 if (!dev->parent) {
102 dev_err(dev, "Missing parent device\n");
103 return -ENODEV;
104 }
105
106 /* For DT boot, get platform data from parent. i.e. usbhshost */
107 if (dev->of_node) {
108 pdata = dev_get_platdata(dev->parent);
109 dev->platform_data = pdata;
110 }
111
112 if (!pdata) {
113 dev_err(dev, "Missing platform data\n");
114 return -ENODEV;
115 }
116
117 irq = platform_get_irq(pdev, 0);
118 if (irq < 0)
119 return irq;
120 if (!irq)
> 121 return -ENIVAL;
122
123 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
124 regs = devm_ioremap_resource(dev, res);
125 if (IS_ERR(regs))
126 return PTR_ERR(regs);
127
128 /*
129 * Right now device-tree probed devices don't get dma_mask set.
130 * Since shared usb code relies on it, set it here for now.
131 * Once we have dma capability bindings this can go away.
132 */
133 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
134 if (ret)
135 return ret;
136
137 ret = -ENODEV;
138 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev,
139 dev_name(dev));
140 if (!hcd) {
141 dev_err(dev, "Failed to create HCD\n");
142 return -ENOMEM;
143 }
144
145 hcd->rsrc_start = res->start;
146 hcd->rsrc_len = resource_size(res);
147 hcd->regs = regs;
148 hcd_to_ehci(hcd)->caps = regs;
149
150 omap = (struct omap_hcd *)hcd_to_ehci(hcd)->priv;
151 omap->nports = pdata->nports;
152
153 platform_set_drvdata(pdev, hcd);
154
155 /* get the PHY devices if needed */
156 for (i = 0 ; i < omap->nports ; i++) {
157 struct usb_phy *phy;
158
159 /* get the PHY device */
160 phy = devm_usb_get_phy_by_phandle(dev, "phys", i);
161 if (IS_ERR(phy)) {
162 ret = PTR_ERR(phy);
163 if (ret == -ENODEV) { /* no PHY */
164 phy = NULL;
165 continue;
166 }
167
168 if (ret != -EPROBE_DEFER)
169 dev_err(dev, "Can't get PHY for port %d: %d\n",
170 i, ret);
171 goto err_phy;
172 }
173
174 omap->phy[i] = phy;
175
176 if (pdata->port_mode[i] == OMAP_EHCI_PORT_MODE_PHY) {
177 usb_phy_init(omap->phy[i]);
178 /* bring PHY out of suspend */
179 usb_phy_set_suspend(omap->phy[i], 0);
180 }
181 }
182
183 pm_runtime_enable(dev);
184 pm_runtime_get_sync(dev);
185
186 /*
187 * An undocumented "feature" in the OMAP3 EHCI controller,
188 * causes suspended ports to be taken out of suspend when
189 * the USBCMD.Run/Stop bit is cleared (for example when
190 * we do ehci_bus_suspend).
191 * This breaks suspend-resume if the root-hub is allowed
192 * to suspend. Writing 1 to this undocumented register bit
193 * disables this feature and restores normal behavior.
194 */
195 ehci_write(regs, EHCI_INSNREG04,
196 EHCI_INSNREG04_DISABLE_UNSUSPEND);
197
198 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
199 if (ret) {
200 dev_err(dev, "failed to add hcd with err %d\n", ret);
201 goto err_pm_runtime;
202 }
203 device_wakeup_enable(hcd->self.controller);
204
205 /*
206 * Bring PHYs out of reset for non PHY modes.
207 * Even though HSIC mode is a PHY-less mode, the reset
208 * line exists between the chips and can be modelled
209 * as a PHY device for reset control.
210 */
211 for (i = 0; i < omap->nports; i++) {
212 if (!omap->phy[i] ||
213 pdata->port_mode[i] == OMAP_EHCI_PORT_MODE_PHY)
214 continue;
215
216 usb_phy_init(omap->phy[i]);
217 /* bring PHY out of suspend */
218 usb_phy_set_suspend(omap->phy[i], 0);
219 }
220
221 return 0;
222
223 err_pm_runtime:
224 pm_runtime_put_sync(dev);
225 pm_runtime_disable(dev);
226
227 err_phy:
228 for (i = 0; i < omap->nports; i++) {
229 if (omap->phy[i])
230 usb_phy_shutdown(omap->phy[i]);
231 }
232
233 usb_put_hcd(hcd);
234
235 return ret;
236 }
237
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 55370 bytes --]
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 22/22] usb: host: xhci-tegra: deny IRQ0
2021-10-26 17:39 ` [PATCH v2 22/22] usb: host: xhci-tegra: " Sergey Shtylyov
@ 2021-10-30 22:08 ` kernel test robot
0 siblings, 0 replies; 63+ messages in thread
From: kernel test robot @ 2021-10-30 22:08 UTC (permalink / raw)
To: Sergey Shtylyov, linux-usb, Alan Stern, Greg Kroah-Hartman
Cc: kbuild-all, Thierry Reding, Jonathan Hunter, linux-tegra
[-- Attachment #1: Type: text/plain, Size: 14332 bytes --]
Hi Sergey,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on peter-chen-usb/for-usb-next v5.15-rc7 next-20211029]
[cannot apply to balbi-usb/testing/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Sergey-Shtylyov/Explicitly-deny-IRQ0-in-the-USB-host-drivers/20211027-015925
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/23ab86f72b35fb51cbc8add959ca78506d95ef25
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sergey-Shtylyov/Explicitly-deny-IRQ0-in-the-USB-host-drivers/20211027-015925
git checkout 23ab86f72b35fb51cbc8add959ca78506d95ef25
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/usb/host/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/usb/host/xhci-tegra.c: In function 'tegra_xusb_probe':
>> drivers/usb/host/xhci-tegra.c:1443:25: error: 'ENIVAL' undeclared (first use in this function); did you mean 'EINVAL'?
1443 | return -ENIVAL;
| ^~~~~~
| EINVAL
drivers/usb/host/xhci-tegra.c:1443:25: note: each undeclared identifier is reported only once for each function it appears in
vim +1443 drivers/usb/host/xhci-tegra.c
1400
1401 static int tegra_xusb_probe(struct platform_device *pdev)
1402 {
1403 struct tegra_xusb *tegra;
1404 struct device_node *np;
1405 struct resource *regs;
1406 struct xhci_hcd *xhci;
1407 unsigned int i, j, k;
1408 struct phy *phy;
1409 int err;
1410
1411 BUILD_BUG_ON(sizeof(struct tegra_xusb_fw_header) != 256);
1412
1413 tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL);
1414 if (!tegra)
1415 return -ENOMEM;
1416
1417 tegra->soc = of_device_get_match_data(&pdev->dev);
1418 mutex_init(&tegra->lock);
1419 tegra->dev = &pdev->dev;
1420
1421 err = tegra_xusb_init_context(tegra);
1422 if (err < 0)
1423 return err;
1424
1425 tegra->regs = devm_platform_get_and_ioremap_resource(pdev, 0, ®s);
1426 if (IS_ERR(tegra->regs))
1427 return PTR_ERR(tegra->regs);
1428
1429 tegra->fpci_base = devm_platform_ioremap_resource(pdev, 1);
1430 if (IS_ERR(tegra->fpci_base))
1431 return PTR_ERR(tegra->fpci_base);
1432
1433 if (tegra->soc->has_ipfs) {
1434 tegra->ipfs_base = devm_platform_ioremap_resource(pdev, 2);
1435 if (IS_ERR(tegra->ipfs_base))
1436 return PTR_ERR(tegra->ipfs_base);
1437 }
1438
1439 tegra->xhci_irq = platform_get_irq(pdev, 0);
1440 if (tegra->xhci_irq < 0)
1441 return tegra->xhci_irq;
1442 if (!tegra->xhci_irq)
> 1443 return -ENIVAL;
1444
1445 tegra->mbox_irq = platform_get_irq(pdev, 1);
1446 if (tegra->mbox_irq < 0)
1447 return tegra->mbox_irq;
1448
1449 tegra->padctl = tegra_xusb_padctl_get(&pdev->dev);
1450 if (IS_ERR(tegra->padctl))
1451 return PTR_ERR(tegra->padctl);
1452
1453 np = of_parse_phandle(pdev->dev.of_node, "nvidia,xusb-padctl", 0);
1454 if (!np) {
1455 err = -ENODEV;
1456 goto put_padctl;
1457 }
1458
1459 tegra->padctl_irq = of_irq_get(np, 0);
1460 if (tegra->padctl_irq <= 0) {
1461 err = (tegra->padctl_irq == 0) ? -ENODEV : tegra->padctl_irq;
1462 goto put_padctl;
1463 }
1464
1465 tegra->host_clk = devm_clk_get(&pdev->dev, "xusb_host");
1466 if (IS_ERR(tegra->host_clk)) {
1467 err = PTR_ERR(tegra->host_clk);
1468 dev_err(&pdev->dev, "failed to get xusb_host: %d\n", err);
1469 goto put_padctl;
1470 }
1471
1472 tegra->falcon_clk = devm_clk_get(&pdev->dev, "xusb_falcon_src");
1473 if (IS_ERR(tegra->falcon_clk)) {
1474 err = PTR_ERR(tegra->falcon_clk);
1475 dev_err(&pdev->dev, "failed to get xusb_falcon_src: %d\n", err);
1476 goto put_padctl;
1477 }
1478
1479 tegra->ss_clk = devm_clk_get(&pdev->dev, "xusb_ss");
1480 if (IS_ERR(tegra->ss_clk)) {
1481 err = PTR_ERR(tegra->ss_clk);
1482 dev_err(&pdev->dev, "failed to get xusb_ss: %d\n", err);
1483 goto put_padctl;
1484 }
1485
1486 tegra->ss_src_clk = devm_clk_get(&pdev->dev, "xusb_ss_src");
1487 if (IS_ERR(tegra->ss_src_clk)) {
1488 err = PTR_ERR(tegra->ss_src_clk);
1489 dev_err(&pdev->dev, "failed to get xusb_ss_src: %d\n", err);
1490 goto put_padctl;
1491 }
1492
1493 tegra->hs_src_clk = devm_clk_get(&pdev->dev, "xusb_hs_src");
1494 if (IS_ERR(tegra->hs_src_clk)) {
1495 err = PTR_ERR(tegra->hs_src_clk);
1496 dev_err(&pdev->dev, "failed to get xusb_hs_src: %d\n", err);
1497 goto put_padctl;
1498 }
1499
1500 tegra->fs_src_clk = devm_clk_get(&pdev->dev, "xusb_fs_src");
1501 if (IS_ERR(tegra->fs_src_clk)) {
1502 err = PTR_ERR(tegra->fs_src_clk);
1503 dev_err(&pdev->dev, "failed to get xusb_fs_src: %d\n", err);
1504 goto put_padctl;
1505 }
1506
1507 tegra->pll_u_480m = devm_clk_get(&pdev->dev, "pll_u_480m");
1508 if (IS_ERR(tegra->pll_u_480m)) {
1509 err = PTR_ERR(tegra->pll_u_480m);
1510 dev_err(&pdev->dev, "failed to get pll_u_480m: %d\n", err);
1511 goto put_padctl;
1512 }
1513
1514 tegra->clk_m = devm_clk_get(&pdev->dev, "clk_m");
1515 if (IS_ERR(tegra->clk_m)) {
1516 err = PTR_ERR(tegra->clk_m);
1517 dev_err(&pdev->dev, "failed to get clk_m: %d\n", err);
1518 goto put_padctl;
1519 }
1520
1521 tegra->pll_e = devm_clk_get(&pdev->dev, "pll_e");
1522 if (IS_ERR(tegra->pll_e)) {
1523 err = PTR_ERR(tegra->pll_e);
1524 dev_err(&pdev->dev, "failed to get pll_e: %d\n", err);
1525 goto put_padctl;
1526 }
1527
1528 if (!of_property_read_bool(pdev->dev.of_node, "power-domains")) {
1529 tegra->host_rst = devm_reset_control_get(&pdev->dev,
1530 "xusb_host");
1531 if (IS_ERR(tegra->host_rst)) {
1532 err = PTR_ERR(tegra->host_rst);
1533 dev_err(&pdev->dev,
1534 "failed to get xusb_host reset: %d\n", err);
1535 goto put_padctl;
1536 }
1537
1538 tegra->ss_rst = devm_reset_control_get(&pdev->dev, "xusb_ss");
1539 if (IS_ERR(tegra->ss_rst)) {
1540 err = PTR_ERR(tegra->ss_rst);
1541 dev_err(&pdev->dev, "failed to get xusb_ss reset: %d\n",
1542 err);
1543 goto put_padctl;
1544 }
1545 } else {
1546 err = tegra_xusb_powerdomain_init(&pdev->dev, tegra);
1547 if (err)
1548 goto put_powerdomains;
1549 }
1550
1551 tegra->supplies = devm_kcalloc(&pdev->dev, tegra->soc->num_supplies,
1552 sizeof(*tegra->supplies), GFP_KERNEL);
1553 if (!tegra->supplies) {
1554 err = -ENOMEM;
1555 goto put_powerdomains;
1556 }
1557
1558 regulator_bulk_set_supply_names(tegra->supplies,
1559 tegra->soc->supply_names,
1560 tegra->soc->num_supplies);
1561
1562 err = devm_regulator_bulk_get(&pdev->dev, tegra->soc->num_supplies,
1563 tegra->supplies);
1564 if (err) {
1565 dev_err(&pdev->dev, "failed to get regulators: %d\n", err);
1566 goto put_powerdomains;
1567 }
1568
1569 for (i = 0; i < tegra->soc->num_types; i++) {
1570 if (!strncmp(tegra->soc->phy_types[i].name, "usb2", 4))
1571 tegra->num_usb_phys = tegra->soc->phy_types[i].num;
1572 tegra->num_phys += tegra->soc->phy_types[i].num;
1573 }
1574
1575 tegra->phys = devm_kcalloc(&pdev->dev, tegra->num_phys,
1576 sizeof(*tegra->phys), GFP_KERNEL);
1577 if (!tegra->phys) {
1578 err = -ENOMEM;
1579 goto put_powerdomains;
1580 }
1581
1582 for (i = 0, k = 0; i < tegra->soc->num_types; i++) {
1583 char prop[8];
1584
1585 for (j = 0; j < tegra->soc->phy_types[i].num; j++) {
1586 snprintf(prop, sizeof(prop), "%s-%d",
1587 tegra->soc->phy_types[i].name, j);
1588
1589 phy = devm_phy_optional_get(&pdev->dev, prop);
1590 if (IS_ERR(phy)) {
1591 dev_err(&pdev->dev,
1592 "failed to get PHY %s: %ld\n", prop,
1593 PTR_ERR(phy));
1594 err = PTR_ERR(phy);
1595 goto put_powerdomains;
1596 }
1597
1598 tegra->phys[k++] = phy;
1599 }
1600 }
1601
1602 tegra->hcd = usb_create_hcd(&tegra_xhci_hc_driver, &pdev->dev,
1603 dev_name(&pdev->dev));
1604 if (!tegra->hcd) {
1605 err = -ENOMEM;
1606 goto put_powerdomains;
1607 }
1608
1609 tegra->hcd->skip_phy_initialization = 1;
1610 tegra->hcd->regs = tegra->regs;
1611 tegra->hcd->rsrc_start = regs->start;
1612 tegra->hcd->rsrc_len = resource_size(regs);
1613
1614 /*
1615 * This must happen after usb_create_hcd(), because usb_create_hcd()
1616 * will overwrite the drvdata of the device with the hcd it creates.
1617 */
1618 platform_set_drvdata(pdev, tegra);
1619
1620 err = tegra_xusb_clk_enable(tegra);
1621 if (err) {
1622 dev_err(tegra->dev, "failed to enable clocks: %d\n", err);
1623 goto put_hcd;
1624 }
1625
1626 err = regulator_bulk_enable(tegra->soc->num_supplies, tegra->supplies);
1627 if (err) {
1628 dev_err(tegra->dev, "failed to enable regulators: %d\n", err);
1629 goto disable_clk;
1630 }
1631
1632 err = tegra_xusb_phy_enable(tegra);
1633 if (err < 0) {
1634 dev_err(&pdev->dev, "failed to enable PHYs: %d\n", err);
1635 goto disable_regulator;
1636 }
1637
1638 /*
1639 * The XUSB Falcon microcontroller can only address 40 bits, so set
1640 * the DMA mask accordingly.
1641 */
1642 err = dma_set_mask_and_coherent(tegra->dev, DMA_BIT_MASK(40));
1643 if (err < 0) {
1644 dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err);
1645 goto disable_phy;
1646 }
1647
1648 err = tegra_xusb_request_firmware(tegra);
1649 if (err < 0) {
1650 dev_err(&pdev->dev, "failed to request firmware: %d\n", err);
1651 goto disable_phy;
1652 }
1653
1654 err = tegra_xusb_unpowergate_partitions(tegra);
1655 if (err)
1656 goto free_firmware;
1657
1658 tegra_xusb_config(tegra);
1659
1660 err = tegra_xusb_load_firmware(tegra);
1661 if (err < 0) {
1662 dev_err(&pdev->dev, "failed to load firmware: %d\n", err);
1663 goto powergate;
1664 }
1665
1666 err = usb_add_hcd(tegra->hcd, tegra->xhci_irq, IRQF_SHARED);
1667 if (err < 0) {
1668 dev_err(&pdev->dev, "failed to add USB HCD: %d\n", err);
1669 goto powergate;
1670 }
1671
1672 device_wakeup_enable(tegra->hcd->self.controller);
1673
1674 xhci = hcd_to_xhci(tegra->hcd);
1675
1676 xhci->shared_hcd = usb_create_shared_hcd(&tegra_xhci_hc_driver,
1677 &pdev->dev,
1678 dev_name(&pdev->dev),
1679 tegra->hcd);
1680 if (!xhci->shared_hcd) {
1681 dev_err(&pdev->dev, "failed to create shared HCD\n");
1682 err = -ENOMEM;
1683 goto remove_usb2;
1684 }
1685
1686 err = usb_add_hcd(xhci->shared_hcd, tegra->xhci_irq, IRQF_SHARED);
1687 if (err < 0) {
1688 dev_err(&pdev->dev, "failed to add shared HCD: %d\n", err);
1689 goto put_usb3;
1690 }
1691
1692 err = devm_request_threaded_irq(&pdev->dev, tegra->mbox_irq,
1693 tegra_xusb_mbox_irq,
1694 tegra_xusb_mbox_thread, 0,
1695 dev_name(&pdev->dev), tegra);
1696 if (err < 0) {
1697 dev_err(&pdev->dev, "failed to request IRQ: %d\n", err);
1698 goto remove_usb3;
1699 }
1700
1701 err = devm_request_threaded_irq(&pdev->dev, tegra->padctl_irq, NULL, tegra_xusb_padctl_irq,
1702 IRQF_ONESHOT, dev_name(&pdev->dev), tegra);
1703 if (err < 0) {
1704 dev_err(&pdev->dev, "failed to request padctl IRQ: %d\n", err);
1705 goto remove_usb3;
1706 }
1707
1708 err = tegra_xusb_enable_firmware_messages(tegra);
1709 if (err < 0) {
1710 dev_err(&pdev->dev, "failed to enable messages: %d\n", err);
1711 goto remove_usb3;
1712 }
1713
1714 err = tegra_xusb_init_usb_phy(tegra);
1715 if (err < 0) {
1716 dev_err(&pdev->dev, "failed to init USB PHY: %d\n", err);
1717 goto remove_usb3;
1718 }
1719
1720 /* Enable wake for both USB 2.0 and USB 3.0 roothubs */
1721 device_init_wakeup(&tegra->hcd->self.root_hub->dev, true);
1722 device_init_wakeup(&xhci->shared_hcd->self.root_hub->dev, true);
1723 device_init_wakeup(tegra->dev, true);
1724
1725 pm_runtime_use_autosuspend(tegra->dev);
1726 pm_runtime_set_autosuspend_delay(tegra->dev, 2000);
1727 pm_runtime_mark_last_busy(tegra->dev);
1728 pm_runtime_set_active(tegra->dev);
1729 pm_runtime_enable(tegra->dev);
1730
1731 return 0;
1732
1733 remove_usb3:
1734 usb_remove_hcd(xhci->shared_hcd);
1735 put_usb3:
1736 usb_put_hcd(xhci->shared_hcd);
1737 remove_usb2:
1738 usb_remove_hcd(tegra->hcd);
1739 powergate:
1740 tegra_xusb_powergate_partitions(tegra);
1741 free_firmware:
1742 dma_free_coherent(&pdev->dev, tegra->fw.size, tegra->fw.virt,
1743 tegra->fw.phys);
1744 disable_phy:
1745 tegra_xusb_phy_disable(tegra);
1746 disable_regulator:
1747 regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
1748 disable_clk:
1749 tegra_xusb_clk_disable(tegra);
1750 put_hcd:
1751 usb_put_hcd(tegra->hcd);
1752 put_powerdomains:
1753 tegra_xusb_powerdomain_remove(&pdev->dev, tegra);
1754 put_padctl:
1755 of_node_put(np);
1756 tegra_xusb_padctl_put(tegra->padctl);
1757 return err;
1758 }
1759
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 55370 bytes --]
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 22/22] usb: host: xhci-tegra: deny IRQ0
@ 2021-10-30 22:08 ` kernel test robot
0 siblings, 0 replies; 63+ messages in thread
From: kernel test robot @ 2021-10-30 22:08 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 14739 bytes --]
Hi Sergey,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on peter-chen-usb/for-usb-next v5.15-rc7 next-20211029]
[cannot apply to balbi-usb/testing/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Sergey-Shtylyov/Explicitly-deny-IRQ0-in-the-USB-host-drivers/20211027-015925
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/23ab86f72b35fb51cbc8add959ca78506d95ef25
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sergey-Shtylyov/Explicitly-deny-IRQ0-in-the-USB-host-drivers/20211027-015925
git checkout 23ab86f72b35fb51cbc8add959ca78506d95ef25
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/usb/host/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/usb/host/xhci-tegra.c: In function 'tegra_xusb_probe':
>> drivers/usb/host/xhci-tegra.c:1443:25: error: 'ENIVAL' undeclared (first use in this function); did you mean 'EINVAL'?
1443 | return -ENIVAL;
| ^~~~~~
| EINVAL
drivers/usb/host/xhci-tegra.c:1443:25: note: each undeclared identifier is reported only once for each function it appears in
vim +1443 drivers/usb/host/xhci-tegra.c
1400
1401 static int tegra_xusb_probe(struct platform_device *pdev)
1402 {
1403 struct tegra_xusb *tegra;
1404 struct device_node *np;
1405 struct resource *regs;
1406 struct xhci_hcd *xhci;
1407 unsigned int i, j, k;
1408 struct phy *phy;
1409 int err;
1410
1411 BUILD_BUG_ON(sizeof(struct tegra_xusb_fw_header) != 256);
1412
1413 tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL);
1414 if (!tegra)
1415 return -ENOMEM;
1416
1417 tegra->soc = of_device_get_match_data(&pdev->dev);
1418 mutex_init(&tegra->lock);
1419 tegra->dev = &pdev->dev;
1420
1421 err = tegra_xusb_init_context(tegra);
1422 if (err < 0)
1423 return err;
1424
1425 tegra->regs = devm_platform_get_and_ioremap_resource(pdev, 0, ®s);
1426 if (IS_ERR(tegra->regs))
1427 return PTR_ERR(tegra->regs);
1428
1429 tegra->fpci_base = devm_platform_ioremap_resource(pdev, 1);
1430 if (IS_ERR(tegra->fpci_base))
1431 return PTR_ERR(tegra->fpci_base);
1432
1433 if (tegra->soc->has_ipfs) {
1434 tegra->ipfs_base = devm_platform_ioremap_resource(pdev, 2);
1435 if (IS_ERR(tegra->ipfs_base))
1436 return PTR_ERR(tegra->ipfs_base);
1437 }
1438
1439 tegra->xhci_irq = platform_get_irq(pdev, 0);
1440 if (tegra->xhci_irq < 0)
1441 return tegra->xhci_irq;
1442 if (!tegra->xhci_irq)
> 1443 return -ENIVAL;
1444
1445 tegra->mbox_irq = platform_get_irq(pdev, 1);
1446 if (tegra->mbox_irq < 0)
1447 return tegra->mbox_irq;
1448
1449 tegra->padctl = tegra_xusb_padctl_get(&pdev->dev);
1450 if (IS_ERR(tegra->padctl))
1451 return PTR_ERR(tegra->padctl);
1452
1453 np = of_parse_phandle(pdev->dev.of_node, "nvidia,xusb-padctl", 0);
1454 if (!np) {
1455 err = -ENODEV;
1456 goto put_padctl;
1457 }
1458
1459 tegra->padctl_irq = of_irq_get(np, 0);
1460 if (tegra->padctl_irq <= 0) {
1461 err = (tegra->padctl_irq == 0) ? -ENODEV : tegra->padctl_irq;
1462 goto put_padctl;
1463 }
1464
1465 tegra->host_clk = devm_clk_get(&pdev->dev, "xusb_host");
1466 if (IS_ERR(tegra->host_clk)) {
1467 err = PTR_ERR(tegra->host_clk);
1468 dev_err(&pdev->dev, "failed to get xusb_host: %d\n", err);
1469 goto put_padctl;
1470 }
1471
1472 tegra->falcon_clk = devm_clk_get(&pdev->dev, "xusb_falcon_src");
1473 if (IS_ERR(tegra->falcon_clk)) {
1474 err = PTR_ERR(tegra->falcon_clk);
1475 dev_err(&pdev->dev, "failed to get xusb_falcon_src: %d\n", err);
1476 goto put_padctl;
1477 }
1478
1479 tegra->ss_clk = devm_clk_get(&pdev->dev, "xusb_ss");
1480 if (IS_ERR(tegra->ss_clk)) {
1481 err = PTR_ERR(tegra->ss_clk);
1482 dev_err(&pdev->dev, "failed to get xusb_ss: %d\n", err);
1483 goto put_padctl;
1484 }
1485
1486 tegra->ss_src_clk = devm_clk_get(&pdev->dev, "xusb_ss_src");
1487 if (IS_ERR(tegra->ss_src_clk)) {
1488 err = PTR_ERR(tegra->ss_src_clk);
1489 dev_err(&pdev->dev, "failed to get xusb_ss_src: %d\n", err);
1490 goto put_padctl;
1491 }
1492
1493 tegra->hs_src_clk = devm_clk_get(&pdev->dev, "xusb_hs_src");
1494 if (IS_ERR(tegra->hs_src_clk)) {
1495 err = PTR_ERR(tegra->hs_src_clk);
1496 dev_err(&pdev->dev, "failed to get xusb_hs_src: %d\n", err);
1497 goto put_padctl;
1498 }
1499
1500 tegra->fs_src_clk = devm_clk_get(&pdev->dev, "xusb_fs_src");
1501 if (IS_ERR(tegra->fs_src_clk)) {
1502 err = PTR_ERR(tegra->fs_src_clk);
1503 dev_err(&pdev->dev, "failed to get xusb_fs_src: %d\n", err);
1504 goto put_padctl;
1505 }
1506
1507 tegra->pll_u_480m = devm_clk_get(&pdev->dev, "pll_u_480m");
1508 if (IS_ERR(tegra->pll_u_480m)) {
1509 err = PTR_ERR(tegra->pll_u_480m);
1510 dev_err(&pdev->dev, "failed to get pll_u_480m: %d\n", err);
1511 goto put_padctl;
1512 }
1513
1514 tegra->clk_m = devm_clk_get(&pdev->dev, "clk_m");
1515 if (IS_ERR(tegra->clk_m)) {
1516 err = PTR_ERR(tegra->clk_m);
1517 dev_err(&pdev->dev, "failed to get clk_m: %d\n", err);
1518 goto put_padctl;
1519 }
1520
1521 tegra->pll_e = devm_clk_get(&pdev->dev, "pll_e");
1522 if (IS_ERR(tegra->pll_e)) {
1523 err = PTR_ERR(tegra->pll_e);
1524 dev_err(&pdev->dev, "failed to get pll_e: %d\n", err);
1525 goto put_padctl;
1526 }
1527
1528 if (!of_property_read_bool(pdev->dev.of_node, "power-domains")) {
1529 tegra->host_rst = devm_reset_control_get(&pdev->dev,
1530 "xusb_host");
1531 if (IS_ERR(tegra->host_rst)) {
1532 err = PTR_ERR(tegra->host_rst);
1533 dev_err(&pdev->dev,
1534 "failed to get xusb_host reset: %d\n", err);
1535 goto put_padctl;
1536 }
1537
1538 tegra->ss_rst = devm_reset_control_get(&pdev->dev, "xusb_ss");
1539 if (IS_ERR(tegra->ss_rst)) {
1540 err = PTR_ERR(tegra->ss_rst);
1541 dev_err(&pdev->dev, "failed to get xusb_ss reset: %d\n",
1542 err);
1543 goto put_padctl;
1544 }
1545 } else {
1546 err = tegra_xusb_powerdomain_init(&pdev->dev, tegra);
1547 if (err)
1548 goto put_powerdomains;
1549 }
1550
1551 tegra->supplies = devm_kcalloc(&pdev->dev, tegra->soc->num_supplies,
1552 sizeof(*tegra->supplies), GFP_KERNEL);
1553 if (!tegra->supplies) {
1554 err = -ENOMEM;
1555 goto put_powerdomains;
1556 }
1557
1558 regulator_bulk_set_supply_names(tegra->supplies,
1559 tegra->soc->supply_names,
1560 tegra->soc->num_supplies);
1561
1562 err = devm_regulator_bulk_get(&pdev->dev, tegra->soc->num_supplies,
1563 tegra->supplies);
1564 if (err) {
1565 dev_err(&pdev->dev, "failed to get regulators: %d\n", err);
1566 goto put_powerdomains;
1567 }
1568
1569 for (i = 0; i < tegra->soc->num_types; i++) {
1570 if (!strncmp(tegra->soc->phy_types[i].name, "usb2", 4))
1571 tegra->num_usb_phys = tegra->soc->phy_types[i].num;
1572 tegra->num_phys += tegra->soc->phy_types[i].num;
1573 }
1574
1575 tegra->phys = devm_kcalloc(&pdev->dev, tegra->num_phys,
1576 sizeof(*tegra->phys), GFP_KERNEL);
1577 if (!tegra->phys) {
1578 err = -ENOMEM;
1579 goto put_powerdomains;
1580 }
1581
1582 for (i = 0, k = 0; i < tegra->soc->num_types; i++) {
1583 char prop[8];
1584
1585 for (j = 0; j < tegra->soc->phy_types[i].num; j++) {
1586 snprintf(prop, sizeof(prop), "%s-%d",
1587 tegra->soc->phy_types[i].name, j);
1588
1589 phy = devm_phy_optional_get(&pdev->dev, prop);
1590 if (IS_ERR(phy)) {
1591 dev_err(&pdev->dev,
1592 "failed to get PHY %s: %ld\n", prop,
1593 PTR_ERR(phy));
1594 err = PTR_ERR(phy);
1595 goto put_powerdomains;
1596 }
1597
1598 tegra->phys[k++] = phy;
1599 }
1600 }
1601
1602 tegra->hcd = usb_create_hcd(&tegra_xhci_hc_driver, &pdev->dev,
1603 dev_name(&pdev->dev));
1604 if (!tegra->hcd) {
1605 err = -ENOMEM;
1606 goto put_powerdomains;
1607 }
1608
1609 tegra->hcd->skip_phy_initialization = 1;
1610 tegra->hcd->regs = tegra->regs;
1611 tegra->hcd->rsrc_start = regs->start;
1612 tegra->hcd->rsrc_len = resource_size(regs);
1613
1614 /*
1615 * This must happen after usb_create_hcd(), because usb_create_hcd()
1616 * will overwrite the drvdata of the device with the hcd it creates.
1617 */
1618 platform_set_drvdata(pdev, tegra);
1619
1620 err = tegra_xusb_clk_enable(tegra);
1621 if (err) {
1622 dev_err(tegra->dev, "failed to enable clocks: %d\n", err);
1623 goto put_hcd;
1624 }
1625
1626 err = regulator_bulk_enable(tegra->soc->num_supplies, tegra->supplies);
1627 if (err) {
1628 dev_err(tegra->dev, "failed to enable regulators: %d\n", err);
1629 goto disable_clk;
1630 }
1631
1632 err = tegra_xusb_phy_enable(tegra);
1633 if (err < 0) {
1634 dev_err(&pdev->dev, "failed to enable PHYs: %d\n", err);
1635 goto disable_regulator;
1636 }
1637
1638 /*
1639 * The XUSB Falcon microcontroller can only address 40 bits, so set
1640 * the DMA mask accordingly.
1641 */
1642 err = dma_set_mask_and_coherent(tegra->dev, DMA_BIT_MASK(40));
1643 if (err < 0) {
1644 dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err);
1645 goto disable_phy;
1646 }
1647
1648 err = tegra_xusb_request_firmware(tegra);
1649 if (err < 0) {
1650 dev_err(&pdev->dev, "failed to request firmware: %d\n", err);
1651 goto disable_phy;
1652 }
1653
1654 err = tegra_xusb_unpowergate_partitions(tegra);
1655 if (err)
1656 goto free_firmware;
1657
1658 tegra_xusb_config(tegra);
1659
1660 err = tegra_xusb_load_firmware(tegra);
1661 if (err < 0) {
1662 dev_err(&pdev->dev, "failed to load firmware: %d\n", err);
1663 goto powergate;
1664 }
1665
1666 err = usb_add_hcd(tegra->hcd, tegra->xhci_irq, IRQF_SHARED);
1667 if (err < 0) {
1668 dev_err(&pdev->dev, "failed to add USB HCD: %d\n", err);
1669 goto powergate;
1670 }
1671
1672 device_wakeup_enable(tegra->hcd->self.controller);
1673
1674 xhci = hcd_to_xhci(tegra->hcd);
1675
1676 xhci->shared_hcd = usb_create_shared_hcd(&tegra_xhci_hc_driver,
1677 &pdev->dev,
1678 dev_name(&pdev->dev),
1679 tegra->hcd);
1680 if (!xhci->shared_hcd) {
1681 dev_err(&pdev->dev, "failed to create shared HCD\n");
1682 err = -ENOMEM;
1683 goto remove_usb2;
1684 }
1685
1686 err = usb_add_hcd(xhci->shared_hcd, tegra->xhci_irq, IRQF_SHARED);
1687 if (err < 0) {
1688 dev_err(&pdev->dev, "failed to add shared HCD: %d\n", err);
1689 goto put_usb3;
1690 }
1691
1692 err = devm_request_threaded_irq(&pdev->dev, tegra->mbox_irq,
1693 tegra_xusb_mbox_irq,
1694 tegra_xusb_mbox_thread, 0,
1695 dev_name(&pdev->dev), tegra);
1696 if (err < 0) {
1697 dev_err(&pdev->dev, "failed to request IRQ: %d\n", err);
1698 goto remove_usb3;
1699 }
1700
1701 err = devm_request_threaded_irq(&pdev->dev, tegra->padctl_irq, NULL, tegra_xusb_padctl_irq,
1702 IRQF_ONESHOT, dev_name(&pdev->dev), tegra);
1703 if (err < 0) {
1704 dev_err(&pdev->dev, "failed to request padctl IRQ: %d\n", err);
1705 goto remove_usb3;
1706 }
1707
1708 err = tegra_xusb_enable_firmware_messages(tegra);
1709 if (err < 0) {
1710 dev_err(&pdev->dev, "failed to enable messages: %d\n", err);
1711 goto remove_usb3;
1712 }
1713
1714 err = tegra_xusb_init_usb_phy(tegra);
1715 if (err < 0) {
1716 dev_err(&pdev->dev, "failed to init USB PHY: %d\n", err);
1717 goto remove_usb3;
1718 }
1719
1720 /* Enable wake for both USB 2.0 and USB 3.0 roothubs */
1721 device_init_wakeup(&tegra->hcd->self.root_hub->dev, true);
1722 device_init_wakeup(&xhci->shared_hcd->self.root_hub->dev, true);
1723 device_init_wakeup(tegra->dev, true);
1724
1725 pm_runtime_use_autosuspend(tegra->dev);
1726 pm_runtime_set_autosuspend_delay(tegra->dev, 2000);
1727 pm_runtime_mark_last_busy(tegra->dev);
1728 pm_runtime_set_active(tegra->dev);
1729 pm_runtime_enable(tegra->dev);
1730
1731 return 0;
1732
1733 remove_usb3:
1734 usb_remove_hcd(xhci->shared_hcd);
1735 put_usb3:
1736 usb_put_hcd(xhci->shared_hcd);
1737 remove_usb2:
1738 usb_remove_hcd(tegra->hcd);
1739 powergate:
1740 tegra_xusb_powergate_partitions(tegra);
1741 free_firmware:
1742 dma_free_coherent(&pdev->dev, tegra->fw.size, tegra->fw.virt,
1743 tegra->fw.phys);
1744 disable_phy:
1745 tegra_xusb_phy_disable(tegra);
1746 disable_regulator:
1747 regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
1748 disable_clk:
1749 tegra_xusb_clk_disable(tegra);
1750 put_hcd:
1751 usb_put_hcd(tegra->hcd);
1752 put_powerdomains:
1753 tegra_xusb_powerdomain_remove(&pdev->dev, tegra);
1754 put_padctl:
1755 of_node_put(np);
1756 tegra_xusb_padctl_put(tegra->padctl);
1757 return err;
1758 }
1759
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 55370 bytes --]
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
2021-10-30 8:54 ` Greg Kroah-Hartman
@ 2021-11-01 20:39 ` Sergey Shtylyov
-1 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-11-01 20:39 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-usb, Alan Stern, Krzysztof Kozlowski, linux-arm-kernel,
linux-samsung-soc
Hello!
On 10/30/21 11:54 AM, Greg Kroah-Hartman wrote:
>> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
>> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
>> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>>
>> Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>> Acked-by: Alan Stern <stern@rowland.harvard.edu>
>> ---
>> Changes in version 2:
>> - added Alan's ACK.
>>
>> drivers/usb/host/ehci-exynos.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
>> index 1a9b7572e17f..ff4e1261801a 100644
>> --- a/drivers/usb/host/ehci-exynos.c
>> +++ b/drivers/usb/host/ehci-exynos.c
>> @@ -207,6 +207,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
>> err = irq;
>> goto fail_io;
>> }
>> + if (!irq) {
>> + err = -EINVAL;
>> + goto fail_io;
>> + }
>
> This is a huge sign that the api being used here is broken.
And you're telling me that after I've wasted time on v2? :-( Well, at least the series had
couple blunders, so it couldn't merged for 5.16-rc1 anyway (not sure why these weren't detected
in v1).
> Please fix the root cause here, if returning a 0 is an error, then have
> the function you called to get this irq return an error.
Well, technically not, although that doesn't match the kernel-doc for the function now.
I only don't understand why returning IRQ0 hasn't been replaced still...
> Otherwise you
> will have to fix ALL callers, and people will always get it wrong.
> Fix the root cause here, don't paper it over.
As I have already told you, I won't have to do it as filtering out is only needed iff 0 is
used as an indication for something special. IRQ0 is still perfectly valid for request_irq()
and is even called by arch/{aplha|mips|x86}...
> thanks,
>
> greg k-h
MBR, Sergey
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
@ 2021-11-01 20:39 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-11-01 20:39 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-usb, Alan Stern, Krzysztof Kozlowski, linux-arm-kernel,
linux-samsung-soc
Hello!
On 10/30/21 11:54 AM, Greg Kroah-Hartman wrote:
>> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
>> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
>> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>>
>> Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>> Acked-by: Alan Stern <stern@rowland.harvard.edu>
>> ---
>> Changes in version 2:
>> - added Alan's ACK.
>>
>> drivers/usb/host/ehci-exynos.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
>> index 1a9b7572e17f..ff4e1261801a 100644
>> --- a/drivers/usb/host/ehci-exynos.c
>> +++ b/drivers/usb/host/ehci-exynos.c
>> @@ -207,6 +207,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
>> err = irq;
>> goto fail_io;
>> }
>> + if (!irq) {
>> + err = -EINVAL;
>> + goto fail_io;
>> + }
>
> This is a huge sign that the api being used here is broken.
And you're telling me that after I've wasted time on v2? :-( Well, at least the series had
couple blunders, so it couldn't merged for 5.16-rc1 anyway (not sure why these weren't detected
in v1).
> Please fix the root cause here, if returning a 0 is an error, then have
> the function you called to get this irq return an error.
Well, technically not, although that doesn't match the kernel-doc for the function now.
I only don't understand why returning IRQ0 hasn't been replaced still...
> Otherwise you
> will have to fix ALL callers, and people will always get it wrong.
> Fix the root cause here, don't paper it over.
As I have already told you, I won't have to do it as filtering out is only needed iff 0 is
used as an indication for something special. IRQ0 is still perfectly valid for request_irq()
and is even called by arch/{aplha|mips|x86}...
> thanks,
>
> greg k-h
MBR, Sergey
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
2021-11-01 20:39 ` Sergey Shtylyov
@ 2021-11-02 13:55 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 63+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-02 13:55 UTC (permalink / raw)
To: Sergey Shtylyov
Cc: linux-usb, Alan Stern, Krzysztof Kozlowski, linux-arm-kernel,
linux-samsung-soc
On Mon, Nov 01, 2021 at 11:39:13PM +0300, Sergey Shtylyov wrote:
> Hello!
>
> On 10/30/21 11:54 AM, Greg Kroah-Hartman wrote:
>
> >> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> >> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> >> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
> >>
> >> Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
> >> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> >> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> >> ---
> >> Changes in version 2:
> >> - added Alan's ACK.
> >>
> >> drivers/usb/host/ehci-exynos.c | 4 ++++
> >> 1 file changed, 4 insertions(+)
> >>
> >> diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
> >> index 1a9b7572e17f..ff4e1261801a 100644
> >> --- a/drivers/usb/host/ehci-exynos.c
> >> +++ b/drivers/usb/host/ehci-exynos.c
> >> @@ -207,6 +207,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
> >> err = irq;
> >> goto fail_io;
> >> }
> >> + if (!irq) {
> >> + err = -EINVAL;
> >> + goto fail_io;
> >> + }
> >
> > This is a huge sign that the api being used here is broken.
>
> And you're telling me that after I've wasted time on v2? :-( Well, at least the series had
> couple blunders, so it couldn't merged for 5.16-rc1 anyway (not sure why these weren't detected
> in v1).
I thought about it some more and noticed it on your v2 submission.
> > Please fix the root cause here, if returning a 0 is an error, then have
> > the function you called to get this irq return an error.
>
> Well, technically not, although that doesn't match the kernel-doc for the function now.
> I only don't understand why returning IRQ0 hasn't been replaced still...
Then please work on that.
> > Otherwise you
> > will have to fix ALL callers, and people will always get it wrong.
> > Fix the root cause here, don't paper it over.
>
> As I have already told you, I won't have to do it as filtering out is only needed iff 0 is
> used as an indication for something special. IRQ0 is still perfectly valid for request_irq()
> and is even called by arch/{aplha|mips|x86}...
If it is valid, then why can it not be a valid irq for all of these
drivers that you are changing here? What is preventing them from
running on the platforms where 0 is a valid irq value?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
@ 2021-11-02 13:55 ` Greg Kroah-Hartman
0 siblings, 0 replies; 63+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-02 13:55 UTC (permalink / raw)
To: Sergey Shtylyov
Cc: linux-usb, Alan Stern, Krzysztof Kozlowski, linux-arm-kernel,
linux-samsung-soc
On Mon, Nov 01, 2021 at 11:39:13PM +0300, Sergey Shtylyov wrote:
> Hello!
>
> On 10/30/21 11:54 AM, Greg Kroah-Hartman wrote:
>
> >> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> >> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> >> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
> >>
> >> Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
> >> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> >> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> >> ---
> >> Changes in version 2:
> >> - added Alan's ACK.
> >>
> >> drivers/usb/host/ehci-exynos.c | 4 ++++
> >> 1 file changed, 4 insertions(+)
> >>
> >> diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
> >> index 1a9b7572e17f..ff4e1261801a 100644
> >> --- a/drivers/usb/host/ehci-exynos.c
> >> +++ b/drivers/usb/host/ehci-exynos.c
> >> @@ -207,6 +207,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
> >> err = irq;
> >> goto fail_io;
> >> }
> >> + if (!irq) {
> >> + err = -EINVAL;
> >> + goto fail_io;
> >> + }
> >
> > This is a huge sign that the api being used here is broken.
>
> And you're telling me that after I've wasted time on v2? :-( Well, at least the series had
> couple blunders, so it couldn't merged for 5.16-rc1 anyway (not sure why these weren't detected
> in v1).
I thought about it some more and noticed it on your v2 submission.
> > Please fix the root cause here, if returning a 0 is an error, then have
> > the function you called to get this irq return an error.
>
> Well, technically not, although that doesn't match the kernel-doc for the function now.
> I only don't understand why returning IRQ0 hasn't been replaced still...
Then please work on that.
> > Otherwise you
> > will have to fix ALL callers, and people will always get it wrong.
> > Fix the root cause here, don't paper it over.
>
> As I have already told you, I won't have to do it as filtering out is only needed iff 0 is
> used as an indication for something special. IRQ0 is still perfectly valid for request_irq()
> and is even called by arch/{aplha|mips|x86}...
If it is valid, then why can it not be a valid irq for all of these
drivers that you are changing here? What is preventing them from
running on the platforms where 0 is a valid irq value?
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
2021-11-02 13:55 ` Greg Kroah-Hartman
@ 2021-11-02 20:45 ` Sergey Shtylyov
-1 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-11-02 20:45 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-usb, Alan Stern, Krzysztof Kozlowski, linux-arm-kernel,
linux-samsung-soc
HEllo!
On 11/2/21 4:55 PM, Greg Kroah-Hartman wrote:
[...]
>>>> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
>>>> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
>>>> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>>>>
>>>> Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
>>>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>>> Acked-by: Alan Stern <stern@rowland.harvard.edu>
[...]
>>> Otherwise you
>>> will have to fix ALL callers, and people will always get it wrong.
>>> Fix the root cause here, don't paper it over.
>>
>> As I have already told you, I won't have to do it as filtering out is only needed iff 0 is
>> used as an indication for something special. IRQ0 is still perfectly valid for request_irq()
>> and is even called by arch/{aplha|mips|x86}...
"And the latter is called with 0 by", I meant to type... :-/
The arguments I've heard for this ambiguity to continue were that IRQ0 is requested only with
setup_irq() (no longer true) and that these calls are confined to the arch code (still true).
> If it is valid, then why can it not be a valid irq for all of these
> drivers that you are changing here? What is preventing them from
> running on the platforms where 0 is a valid irq value?
These drivers call usb_add_hcd() that only calls request_irq() (via usb_hcd_request_irqs())
if IRQ # is non-zero -- otherwise the driver is supposed to handle the interrupt itself (if it
needs one?) --thus calling usb_add_hcd() with IRQ0 results in non-working HCD without IRQs...
(For libata, ata_host_activate() (called in the end of the driver's probe() methods) checks
if the 'irq' parameter is 0 early and in this case warns about the 'irq_handler' parameter being
non-NULL and calls ata_host_register() without registering the IRQ handler and expects the driver
to set the polling flag, thus if IRQ0 is passed from an (unsuspecting) ATA driver, one gets not
fully functional host driver).)
> thanks,
>
> greg k-h
MBR, Sergey
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
@ 2021-11-02 20:45 ` Sergey Shtylyov
0 siblings, 0 replies; 63+ messages in thread
From: Sergey Shtylyov @ 2021-11-02 20:45 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-usb, Alan Stern, Krzysztof Kozlowski, linux-arm-kernel,
linux-samsung-soc
HEllo!
On 11/2/21 4:55 PM, Greg Kroah-Hartman wrote:
[...]
>>>> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
>>>> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
>>>> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>>>>
>>>> Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
>>>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>>> Acked-by: Alan Stern <stern@rowland.harvard.edu>
[...]
>>> Otherwise you
>>> will have to fix ALL callers, and people will always get it wrong.
>>> Fix the root cause here, don't paper it over.
>>
>> As I have already told you, I won't have to do it as filtering out is only needed iff 0 is
>> used as an indication for something special. IRQ0 is still perfectly valid for request_irq()
>> and is even called by arch/{aplha|mips|x86}...
"And the latter is called with 0 by", I meant to type... :-/
The arguments I've heard for this ambiguity to continue were that IRQ0 is requested only with
setup_irq() (no longer true) and that these calls are confined to the arch code (still true).
> If it is valid, then why can it not be a valid irq for all of these
> drivers that you are changing here? What is preventing them from
> running on the platforms where 0 is a valid irq value?
These drivers call usb_add_hcd() that only calls request_irq() (via usb_hcd_request_irqs())
if IRQ # is non-zero -- otherwise the driver is supposed to handle the interrupt itself (if it
needs one?) --thus calling usb_add_hcd() with IRQ0 results in non-working HCD without IRQs...
(For libata, ata_host_activate() (called in the end of the driver's probe() methods) checks
if the 'irq' parameter is 0 early and in this case warns about the 'irq_handler' parameter being
non-NULL and calls ata_host_register() without registering the IRQ handler and expects the driver
to set the polling flag, thus if IRQ0 is passed from an (unsuspecting) ATA driver, one gets not
fully functional host driver).)
> thanks,
>
> greg k-h
MBR, Sergey
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 63+ messages in thread
end of thread, other threads:[~2021-11-13 7:18 UTC | newest]
Thread overview: 63+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0 Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
2021-10-30 8:54 ` Greg Kroah-Hartman
2021-10-30 8:54 ` Greg Kroah-Hartman
2021-11-01 20:39 ` Sergey Shtylyov
2021-11-01 20:39 ` Sergey Shtylyov
2021-11-02 13:55 ` Greg Kroah-Hartman
2021-11-02 13:55 ` Greg Kroah-Hartman
2021-11-02 20:45 ` Sergey Shtylyov
2021-11-02 20:45 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 02/22] usb: host: ehci-mv: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 03/22] usb: host: ehci-npcm7xx: " Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 04/22] usb: host: ehci-omap: " Sergey Shtylyov
2021-10-30 19:49 ` kernel test robot
2021-10-30 19:49 ` kernel test robot
2021-10-26 17:39 ` [PATCH v2 05/22] usb: host: ehci-platform: " Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 06/22] usb: host: ehci-spear: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 07/22] usb: host: ehci-st: " Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
2021-10-27 6:08 ` Patrice CHOTARD
2021-10-27 6:08 ` Patrice CHOTARD
2021-10-26 17:39 ` [PATCH v2 08/22] usb: host: ohci-at91: " Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 09/22] usb: host: ohci-da8xx: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 10/22] usb: host: ohci-exynos: " Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 11/22] usb: host: ohci-nxp: " Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 18:25 ` Vladimir Zapolskiy
2021-10-26 18:25 ` Vladimir Zapolskiy
2021-10-26 17:39 ` [PATCH v2 12/22] usb: host: ohci-omap: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 13/22] usb: host: ohci-platform: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 14/22] usb: host: ohci-pxa27x: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 15/22] usb: host: ohci-sm501: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 16/22] usb: host: ohci-spear: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 17/22] usb: host: ohci-st: " Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
2021-10-27 6:08 ` Patrice CHOTARD
2021-10-27 6:08 ` Patrice CHOTARD
2021-10-26 17:39 ` [PATCH v2 18/22] usb: host: ohci-tmio: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 19/22] usb: host: xhci-histb: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 20/22] usb: host: xhci-mtk: " Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
2021-10-26 17:39 ` Sergey Shtylyov
2021-10-27 8:54 ` Chunfeng Yun
2021-10-27 8:54 ` Chunfeng Yun
2021-10-27 8:54 ` Chunfeng Yun
2021-10-27 9:18 ` Chunfeng Yun
2021-10-27 9:18 ` Chunfeng Yun
2021-10-27 9:18 ` Chunfeng Yun
2021-10-27 9:25 ` Sergey Shtylyov
2021-10-27 9:25 ` Sergey Shtylyov
2021-10-27 9:25 ` Sergey Shtylyov
2021-10-27 9:35 ` Chunfeng Yun
2021-10-27 9:35 ` Chunfeng Yun
2021-10-27 9:35 ` Chunfeng Yun
2021-10-26 17:39 ` [PATCH v2 21/22] usb: host: xhci-plat: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 22/22] usb: host: xhci-tegra: " Sergey Shtylyov
2021-10-30 22:08 ` kernel test robot
2021-10-30 22:08 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.