From patchwork Tue Oct 26 17:39:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B4BEC433F5 for ; Tue, 26 Oct 2021 17:39:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8424A6103C for ; Tue, 26 Oct 2021 17:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237847AbhJZRmN (ORCPT ); Tue, 26 Oct 2021 13:42:13 -0400 Received: from mxout03.lancloud.ru ([45.84.86.113]:35604 "EHLO mxout03.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235281AbhJZRmL (ORCPT ); Tue, 26 Oct 2021 13:42:11 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru 3E95E206178B Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" CC: Krzysztof Kozlowski , , Subject: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:22 +0300 Message-ID: <20211026173943.6829-2-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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) { From patchwork Tue Oct 26 17:39:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EBBEC433FE for ; Tue, 26 Oct 2021 17:39:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 35AF760F9D for ; Tue, 26 Oct 2021 17:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237620AbhJZRmL (ORCPT ); Tue, 26 Oct 2021 13:42:11 -0400 Received: from mxout01.lancloud.ru ([45.84.86.81]:51746 "EHLO mxout01.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235561AbhJZRmL (ORCPT ); Tue, 26 Oct 2021 13:42:11 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout01.lancloud.ru 7D6A72076EBF Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" Subject: [PATCH v2 02/22] usb: host: ehci-mv: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:23 +0300 Message-ID: <20211026173943.6829-3-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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); From patchwork Tue Oct 26 17:39:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 115B0C433EF for ; Tue, 26 Oct 2021 17:39:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EAB1260F9D for ; Tue, 26 Oct 2021 17:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237843AbhJZRmP (ORCPT ); Tue, 26 Oct 2021 13:42:15 -0400 Received: from mxout02.lancloud.ru ([45.84.86.82]:57200 "EHLO mxout02.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236534AbhJZRmL (ORCPT ); Tue, 26 Oct 2021 13:42:11 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout02.lancloud.ru 7ACFF20C046B Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" CC: Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Subject: [PATCH v2 03/22] usb: host: ehci-npcm7xx: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:24 +0300 Message-ID: <20211026173943.6829-4-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern Reviewed-by: Avi Fishman --- 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. From patchwork Tue Oct 26 17:39:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585291 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6196C433FE for ; Tue, 26 Oct 2021 17:39:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACA636109E for ; Tue, 26 Oct 2021 17:39:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237904AbhJZRmV (ORCPT ); Tue, 26 Oct 2021 13:42:21 -0400 Received: from mxout04.lancloud.ru ([45.84.86.114]:56824 "EHLO mxout04.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237583AbhJZRmP (ORCPT ); Tue, 26 Oct 2021 13:42:15 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru E2C4120A74B4 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" CC: Subject: [PATCH v2 04/22] usb: host: ehci-omap: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:25 +0300 Message-ID: <20211026173943.6829-5-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern Reported-by: kernel test robot --- 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); From patchwork Tue Oct 26 17:39:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB0A8C433F5 for ; Tue, 26 Oct 2021 17:39:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 92F5D60F9D for ; Tue, 26 Oct 2021 17:39:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237848AbhJZRmP (ORCPT ); Tue, 26 Oct 2021 13:42:15 -0400 Received: from mxout02.lancloud.ru ([45.84.86.82]:57216 "EHLO mxout02.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236615AbhJZRmO (ORCPT ); Tue, 26 Oct 2021 13:42:14 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout02.lancloud.ru 4B22920C0475 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" CC: Subject: [PATCH v2 05/22] usb: host: ehci-platform: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:26 +0300 Message-ID: <20211026173943.6829-6-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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)); From patchwork Tue Oct 26 17:39:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4ABFC4332F for ; Tue, 26 Oct 2021 17:39:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C736A6109E for ; Tue, 26 Oct 2021 17:39:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237881AbhJZRmS (ORCPT ); Tue, 26 Oct 2021 13:42:18 -0400 Received: from mxout04.lancloud.ru ([45.84.86.114]:56832 "EHLO mxout04.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231618AbhJZRmP (ORCPT ); Tue, 26 Oct 2021 13:42:15 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 9B83120A74B7 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" Subject: [PATCH v2 06/22] usb: host: ehci-spear: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:27 +0300 Message-ID: <20211026173943.6829-7-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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. From patchwork Tue Oct 26 17:39:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 176AAC43219 for ; Tue, 26 Oct 2021 17:40:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 032E961002 for ; Tue, 26 Oct 2021 17:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237901AbhJZRmT (ORCPT ); Tue, 26 Oct 2021 13:42:19 -0400 Received: from mxout03.lancloud.ru ([45.84.86.113]:35614 "EHLO mxout03.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237772AbhJZRmP (ORCPT ); Tue, 26 Oct 2021 13:42:15 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru 10433206179C Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" CC: Patrice Chotard , Subject: [PATCH v2 07/22] usb: host: ehci-st: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:28 +0300 Message-ID: <20211026173943.6829-8-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern Reviewed-by: Patrice Chotard --- 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"); From patchwork Tue Oct 26 17:39:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFA11C433F5 for ; Tue, 26 Oct 2021 17:39:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D75A66103C for ; Tue, 26 Oct 2021 17:39:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237924AbhJZRmU (ORCPT ); Tue, 26 Oct 2021 13:42:20 -0400 Received: from mxout01.lancloud.ru ([45.84.86.81]:51758 "EHLO mxout01.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237834AbhJZRmP (ORCPT ); Tue, 26 Oct 2021 13:42:15 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout01.lancloud.ru 8B454209033C Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" CC: Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Subject: [PATCH v2 08/22] usb: host: ohci-at91: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:29 +0300 Message-ID: <20211026173943.6829-9-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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) From patchwork Tue Oct 26 17:39:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4558C433FE for ; Tue, 26 Oct 2021 17:39:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B7AB861040 for ; Tue, 26 Oct 2021 17:39:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237857AbhJZRmR (ORCPT ); Tue, 26 Oct 2021 13:42:17 -0400 Received: from mxout01.lancloud.ru ([45.84.86.81]:51768 "EHLO mxout01.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237846AbhJZRmP (ORCPT ); Tue, 26 Oct 2021 13:42:15 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout01.lancloud.ru 12B952076EBF Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" Subject: [PATCH v2 09/22] usb: host: ohci-da8xx: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:30 +0300 Message-ID: <20211026173943.6829-10-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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) From patchwork Tue Oct 26 17:39:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DBF3C433F5 for ; Tue, 26 Oct 2021 17:39:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 66B1D61002 for ; Tue, 26 Oct 2021 17:39:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237858AbhJZRmW (ORCPT ); Tue, 26 Oct 2021 13:42:22 -0400 Received: from mxout03.lancloud.ru ([45.84.86.113]:35626 "EHLO mxout03.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237849AbhJZRmP (ORCPT ); Tue, 26 Oct 2021 13:42:15 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru 804B420617A8 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" CC: Krzysztof Kozlowski , , Subject: [PATCH v2 10/22] usb: host: ohci-exynos: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:31 +0300 Message-ID: <20211026173943.6829-11-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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); From patchwork Tue Oct 26 17:39:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D92DBC43217 for ; Tue, 26 Oct 2021 17:39:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C25F16103C for ; Tue, 26 Oct 2021 17:39:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237919AbhJZRmW (ORCPT ); Tue, 26 Oct 2021 13:42:22 -0400 Received: from mxout04.lancloud.ru ([45.84.86.114]:56842 "EHLO mxout04.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237855AbhJZRmP (ORCPT ); Tue, 26 Oct 2021 13:42:15 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru E338520A74C3 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" CC: Vladimir Zapolskiy , Subject: [PATCH v2 11/22] usb: host: ohci-nxp: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:32 +0300 Message-ID: <20211026173943.6829-12-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern Acked-by: Vladimir Zapolskiy --- 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); From patchwork Tue Oct 26 17:39:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585299 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6EB6C4167B for ; Tue, 26 Oct 2021 17:40:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F07B61040 for ; Tue, 26 Oct 2021 17:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237860AbhJZRmX (ORCPT ); Tue, 26 Oct 2021 13:42:23 -0400 Received: from mxout01.lancloud.ru ([45.84.86.81]:51778 "EHLO mxout01.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237856AbhJZRmP (ORCPT ); Tue, 26 Oct 2021 13:42:15 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout01.lancloud.ru 45A4A2093220 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" CC: Subject: [PATCH v2 12/22] usb: host: ohci-omap: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:33 +0300 Message-ID: <20211026173943.6829-13-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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; From patchwork Tue Oct 26 17:39:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FE85C433F5 for ; Tue, 26 Oct 2021 17:40:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B84161002 for ; Tue, 26 Oct 2021 17:40:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237925AbhJZRmY (ORCPT ); Tue, 26 Oct 2021 13:42:24 -0400 Received: from mxout04.lancloud.ru ([45.84.86.114]:56852 "EHLO mxout04.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237869AbhJZRmS (ORCPT ); Tue, 26 Oct 2021 13:42:18 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 9C85420A74B7 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" Subject: [PATCH v2 13/22] usb: host: ohci-platform: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:34 +0300 Message-ID: <20211026173943.6829-14-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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)); From patchwork Tue Oct 26 17:39:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C1F8C433FE for ; Tue, 26 Oct 2021 17:40:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0718260F9D for ; Tue, 26 Oct 2021 17:40:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237932AbhJZRm3 (ORCPT ); Tue, 26 Oct 2021 13:42:29 -0400 Received: from mxout02.lancloud.ru ([45.84.86.82]:57232 "EHLO mxout02.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236609AbhJZRmT (ORCPT ); Tue, 26 Oct 2021 13:42:19 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout02.lancloud.ru C25DE20C0461 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" Subject: [PATCH v2 14/22] usb: host: ohci-pxa27x: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:35 +0300 Message-ID: <20211026173943.6829-15-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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)) From patchwork Tue Oct 26 17:39:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E41E6C433FE for ; Tue, 26 Oct 2021 17:40:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF21D60F9D for ; Tue, 26 Oct 2021 17:40:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237940AbhJZRmY (ORCPT ); Tue, 26 Oct 2021 13:42:24 -0400 Received: from mxout02.lancloud.ru ([45.84.86.82]:57238 "EHLO mxout02.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237885AbhJZRmT (ORCPT ); Tue, 26 Oct 2021 13:42:19 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout02.lancloud.ru EB60E20C089E Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" Subject: [PATCH v2 15/22] usb: host: ohci-sm501: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:36 +0300 Message-ID: <20211026173943.6829-16-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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) { From patchwork Tue Oct 26 17:39:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E472C433F5 for ; Tue, 26 Oct 2021 17:40:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07D3961002 for ; Tue, 26 Oct 2021 17:40:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237883AbhJZRm2 (ORCPT ); Tue, 26 Oct 2021 13:42:28 -0400 Received: from mxout03.lancloud.ru ([45.84.86.113]:35642 "EHLO mxout03.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237886AbhJZRmT (ORCPT ); Tue, 26 Oct 2021 13:42:19 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru 19EFA20617B1 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" Subject: [PATCH v2 16/22] usb: host: ohci-spear: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:37 +0300 Message-ID: <20211026173943.6829-17-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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. From patchwork Tue Oct 26 17:39:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD0D8C4332F for ; Tue, 26 Oct 2021 17:40:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4FA56103C for ; Tue, 26 Oct 2021 17:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237951AbhJZRmZ (ORCPT ); Tue, 26 Oct 2021 13:42:25 -0400 Received: from mxout03.lancloud.ru ([45.84.86.113]:35648 "EHLO mxout03.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231618AbhJZRmT (ORCPT ); Tue, 26 Oct 2021 13:42:19 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru 467E620617BC Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" CC: Patrice Chotard , Subject: [PATCH v2 17/22] usb: host: ohci-st: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:38 +0300 Message-ID: <20211026173943.6829-18-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern Reviewed-by: Patrice Chotard --- 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) { From patchwork Tue Oct 26 17:39:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585309 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B17E5C433EF for ; Tue, 26 Oct 2021 17:40:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94B656103C for ; Tue, 26 Oct 2021 17:40:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237928AbhJZRm0 (ORCPT ); Tue, 26 Oct 2021 13:42:26 -0400 Received: from mxout04.lancloud.ru ([45.84.86.114]:56862 "EHLO mxout04.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237888AbhJZRmT (ORCPT ); Tue, 26 Oct 2021 13:42:19 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 689C220A74B4 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" Subject: [PATCH v2 18/22] usb: host: ohci-tmio: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:39 +0300 Message-ID: <20211026173943.6829-19-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: Alan Stern --- 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) { From patchwork Tue Oct 26 17:39:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585305 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 930EAC43217 for ; Tue, 26 Oct 2021 17:40:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B11461002 for ; Tue, 26 Oct 2021 17:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237943AbhJZRmZ (ORCPT ); Tue, 26 Oct 2021 13:42:25 -0400 Received: from mxout01.lancloud.ru ([45.84.86.81]:51788 "EHLO mxout01.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237894AbhJZRmT (ORCPT ); Tue, 26 Oct 2021 13:42:19 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout01.lancloud.ru 8F9502076EBF Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Mathias Nyman , "Greg Kroah-Hartman" Subject: [PATCH v2 19/22] usb: host: xhci-histb: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:40 +0300 Message-ID: <20211026173943.6829-20-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 --- 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)) From patchwork Tue Oct 26 17:39:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585315 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DA1CC433EF for ; Tue, 26 Oct 2021 17:40:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2782A61002 for ; Tue, 26 Oct 2021 17:40:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231618AbhJZRm2 (ORCPT ); Tue, 26 Oct 2021 13:42:28 -0400 Received: from mxout01.lancloud.ru ([45.84.86.81]:51796 "EHLO mxout01.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237871AbhJZRmT (ORCPT ); Tue, 26 Oct 2021 13:42:19 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout01.lancloud.ru B67452093220 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Mathias Nyman , "Greg Kroah-Hartman" CC: Chunfeng Yun , Matthias Brugger , , Subject: [PATCH v2 20/22] usb: host: xhci-mtk: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:41 +0300 Message-ID: <20211026173943.6829-21-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 --- 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"); From patchwork Tue Oct 26 17:39:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5042EC433F5 for ; Tue, 26 Oct 2021 17:40:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3AEB060F9D for ; Tue, 26 Oct 2021 17:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237888AbhJZRm1 (ORCPT ); Tue, 26 Oct 2021 13:42:27 -0400 Received: from mxout04.lancloud.ru ([45.84.86.114]:56870 "EHLO mxout04.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237911AbhJZRmT (ORCPT ); Tue, 26 Oct 2021 13:42:19 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru E9F7320A74C4 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" Subject: [PATCH v2 21/22] usb: host: xhci-plat: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:42 +0300 Message-ID: <20211026173943.6829-22-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 --- 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 From patchwork Tue Oct 26 17:39:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12585313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7A54C433FE for ; Tue, 26 Oct 2021 17:40:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2F2461002 for ; Tue, 26 Oct 2021 17:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237911AbhJZRm1 (ORCPT ); Tue, 26 Oct 2021 13:42:27 -0400 Received: from mxout02.lancloud.ru ([45.84.86.82]:57250 "EHLO mxout02.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237912AbhJZRmV (ORCPT ); Tue, 26 Oct 2021 13:42:21 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout02.lancloud.ru 16A6E20C096E Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: , Alan Stern , "Greg Kroah-Hartman" CC: Thierry Reding , Jonathan Hunter , Subject: [PATCH v2 22/22] usb: host: xhci-tegra: deny IRQ0 Date: Tue, 26 Oct 2021 20:39:43 +0300 Message-ID: <20211026173943.6829-23-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211026173943.6829-1-s.shtylyov@omp.ru> References: <20211026173943.6829-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Reported-by: kernel test robot --- 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)