From patchwork Mon Aug 9 20:21:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12427235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08B0DC4338F for ; Mon, 9 Aug 2021 20:24:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7ACE76101E for ; Mon, 9 Aug 2021 20:24:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7ACE76101E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=omp.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:CC:References:To:From:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Amb/HGLJ5sPLXpbImHlBsweUfezcqoEAXJkbReqOcRM=; b=zzPF8JuNYeKyS+P0LuyM5bYhll Hxdv1ySPh13SnA1NT77/LmDaOrons7V5f6t1484kJVd/y07T/WQ8tSByVoB3XqnKixQR7p4xFcvZg KM663HXdKEJmJVpWc5UM3RKiO6zRpXhMFtccarCH2Rid+nTi6lGhcnqNn+pD/Ko0IKUI9TkbTPUDy uJkunlLTQxzKc2cg6JbMv2I8/rXPRPaYM9+Jq1UUslHIEcOg3apIzeaK4puNKQqBLYjvIb032iXEQ 16SY/kgaHwwRiAUrjAnl2bNbB+KIjVlLGbOU6FGkS8A4CPzvVff3QfuF4l/E3UIifdoy7o9nxhGVZ qkfNTE2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDBmB-001wHn-Ay; Mon, 09 Aug 2021 20:21:35 +0000 Received: from mxout02.lancloud.ru ([45.84.86.82]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDBm5-001wFc-M4; Mon, 09 Aug 2021 20:21:31 +0000 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout02.lancloud.ru 1C688224368B Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: [PATCH v2 1/9] usb: dwc3: meson-g12a: add IRQ check From: Sergey Shtylyov To: , Greg Kroah-Hartman , Felipe Balbi References: <47bacc02-4e34-3208-779c-7072a6261782@omp.ru> CC: Neil Armstrong , Kevin Hilman , Jerome Brunet , "Martin Blumenstingl" , , Organization: Open Mobile Platform Message-ID: <96106462-5538-0b2f-f2ab-ee56e4853912@omp.ru> Date: Mon, 9 Aug 2021 23:21:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <47bacc02-4e34-3208-779c-7072a6261782@omp.ru> Content-Language: en-US X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210809_132129_952515_8754E175 X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_threaded_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_threaded_irq() with the invalid IRQ #s. Fixes: f90db10779ad ("usb: dwc3: meson-g12a: Add support for IRQ based OTG switching") Signed-off-by: Sergey Shtylyov Reviewed-by: Martin Blumenstingl Acked-by: Felipe Balbi --- Changes in version 2: - added Martin's and Felipe's tags. drivers/usb/dwc3/dwc3-meson-g12a.c | 2 ++ 1 file changed, 2 insertions(+) Index: usb/drivers/usb/dwc3/dwc3-meson-g12a.c =================================================================== --- usb.orig/drivers/usb/dwc3/dwc3-meson-g12a.c +++ usb/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -598,6 +598,8 @@ static int dwc3_meson_g12a_otg_init(stru USB_R5_ID_DIG_IRQ, 0); irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, dwc3_meson_g12a_irq_thread, IRQF_ONESHOT, pdev->name, priv); From patchwork Mon Aug 9 20:27: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: 12427245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2442FC4338F for ; Mon, 9 Aug 2021 20:29:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 885A261040 for ; Mon, 9 Aug 2021 20:29:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 885A261040 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=omp.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:From:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vkwsloyuKfJFDBS2FUalNhcomA0eyP+z817suawEOqY=; b=1TEnr5GJJMNsLH i9ETLORf+Ej6y1xuFES7esi+2c/CEASl6kQSfvs2/kpm6S36Z7SLcbcFdX7s0tSk27sXH4AspGgBd zpRPJjUdFzjPHoBEoRZ5hKqQEx+zq5QQ7FxmGZDwGC7GQrSGFrZ7zCAIieldedwiAtheXGYuJbUP4 qPRsxtgd6sGho/WSkidFr8BYyH8sbQzCivl9vIQkm6WdtbqtNXlnOCM27iEQrwMNtvwAFQXIm654j VLHjFJmUv0qdtCYBBzUa4N/MWtYd5sQkChX0na3NHx8VXlxT4HwtGN1cNVxlFT/tct+2CklhRHKWk qMX/meFArhuZhu1gp0EQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDBs1-001wzW-43; Mon, 09 Aug 2021 20:27:37 +0000 Received: from mxout04.lancloud.ru ([45.84.86.114]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDBrx-001wys-9B for linux-arm-kernel@lists.infradead.org; Mon, 09 Aug 2021 20:27:35 +0000 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 2B80F20B305A Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: [PATCH v2 3/6] usb: gadget: udc: at91: add IRQ check From: Sergey Shtylyov To: , Greg Kroah-Hartman , Felipe Balbi References: <47bacc02-4e34-3208-779c-7072a6261782@omp.ru> Organization: Open Mobile Platform Message-ID: <6654a224-739a-1a80-12f0-76d920f87b6c@omp.ru> Date: Mon, 9 Aug 2021 23:27:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <47bacc02-4e34-3208-779c-7072a6261782@omp.ru> Content-Language: en-US X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210809_132733_551378_28478643 X-CRM114-Status: GOOD ( 12.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Ludovic Desroches , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: 8b2e76687b39 ("USB: AT91 UDC updates, mostly power management") Signed-off-by: Sergey Shtylyov Acked-by: Felipe Balbi --- Changes in version 2: - added Felipe's ACK. drivers/usb/gadget/udc/at91_udc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: usb/drivers/usb/gadget/udc/at91_udc.c =================================================================== --- usb.orig/drivers/usb/gadget/udc/at91_udc.c +++ usb/drivers/usb/gadget/udc/at91_udc.c @@ -1876,7 +1876,9 @@ static int at91udc_probe(struct platform clk_disable(udc->iclk); /* request UDC and maybe VBUS irqs */ - udc->udp_irq = platform_get_irq(pdev, 0); + udc->udp_irq = retval = platform_get_irq(pdev, 0); + if (retval < 0) + goto err_unprepare_iclk; retval = devm_request_irq(dev, udc->udp_irq, at91_udc_irq, 0, driver_name, udc); if (retval) { From patchwork Mon Aug 9 20:35:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12427257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 572ABC4338F for ; Mon, 9 Aug 2021 20:37:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A1F3661002 for ; Mon, 9 Aug 2021 20:37:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A1F3661002 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=omp.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:CC:References:To:From:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=C+wg3ZeGK4e7P1KEzR977XUkFvY8SPtYjkzJ1SBGcU4=; b=gNka6tdZU+j27iYdtNfG4EYTiU P8sCfWM6WGRey3IIWFTVnm9P2kI1P9QV49KPt5Wu3FCqEYY8VrNX/HmpM0JPhcnPAhaULht9j5Njn cXnBVeLZDE4WXm7VOuvuB7YjZV2Jmp0S9wKVDNwKkzNTcMrS33Dd0v0rM9kT0ZG/H81w+GEnEYOdl ReN35FVOXdzgyqhd2FEluKmaaL6ZJX5YDmhswtjV2ioSs6qwhnBMnNyTtY34MLxZEaQqa7jAN/o5y NBbm0U8MSjmIHXrdYZdSp2Piatt2LsgOIHwnX5a6QW59WlAdWxOjmGJtdbTT6fYqO+sws9LtAohf1 m+qZG80Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDBzU-001xn1-Lg; Mon, 09 Aug 2021 20:35:20 +0000 Received: from mxout04.lancloud.ru ([45.84.86.114]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDBzO-001xlU-Qn for linux-arm-kernel@lists.infradead.org; Mon, 09 Aug 2021 20:35:18 +0000 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 1CDFE20CB558 Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: [PATCH v2 4/9] usb: gadget: udc: s3c2410: add IRQ check From: Sergey Shtylyov To: , Greg Kroah-Hartman , Felipe Balbi References: <47bacc02-4e34-3208-779c-7072a6261782@omp.ru> Organization: Open Mobile Platform CC: Krzysztof Kozlowski , , Message-ID: Date: Mon, 9 Aug 2021 23:35:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <47bacc02-4e34-3208-779c-7072a6261782@omp.ru> Content-Language: en-US X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210809_133515_139626_5A97F776 X-CRM114-Status: GOOD ( 13.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling request_irq() with the invalid IRQ #s. Fixes: 188db4435ac6 ("usb: gadget: s3c: use platform resources") Signed-off-by: Sergey Shtylyov Reviewed-by: Krzysztof Kozlowski Acked-by: Felipe Balbi --- drivers/usb/gadget/udc/s3c2410_udc.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) Index: usb/drivers/usb/gadget/udc/s3c2410_udc.c =================================================================== --- usb.orig/drivers/usb/gadget/udc/s3c2410_udc.c +++ usb/drivers/usb/gadget/udc/s3c2410_udc.c @@ -1784,6 +1784,10 @@ static int s3c2410_udc_probe(struct plat s3c2410_udc_reinit(udc); irq_usbd = platform_get_irq(pdev, 0); + if (irq_usbd < 0) { + retval = irq_usbd; + goto err_udc_clk; + } /* irq setup after old hardware state is cleaned up */ retval = request_irq(irq_usbd, s3c2410_udc_irq, From patchwork Mon Aug 9 20:45:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12427269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62183C4338F for ; Mon, 9 Aug 2021 20:47:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0201460F6F for ; Mon, 9 Aug 2021 20:47:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0201460F6F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=omp.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:CC:References:To:From:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=v8+lgswiNP+qfP5TwQjPR1VG9NYk5X0mf2mVbM3pigg=; b=LdWfcBn8/Sb6YSqJHfos33lkQT u+kW+v5pZxfavtJrko4Ds6Y9Lv/V/9cGoijdtV5RLmk4zOvIAosqgkwSwrY0hXfvMcCl1cj7i2JG+ 7C5WnX+KvRio3IyVGadXUoCrZS6/lT0vBMhb+GFWZUdLn98s6NEmjQbiztmSgHxtEbb5SyKwbZmCL YO8jc22urv1svYNQjCzTlEQk0BskNUywRP+ULjR3LCTIi1oky3HBbnYL6vShzKLx0xHCnVmGVxCGu 419iBACVzpXB+yeK5FaIf9XUMvHlnyqaT52b0IBFPxY9c6+AS5vAyvpnvsTeLJwlhsHloP/4wbw5g qpEx4flQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDC9D-001ylh-Eu; Mon, 09 Aug 2021 20:45:23 +0000 Received: from mxout04.lancloud.ru ([45.84.86.114]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDC99-001yl2-6Q for linux-arm-kernel@lists.infradead.org; Mon, 09 Aug 2021 20:45:20 +0000 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 61DA320CDD74 Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: [PATCH v2 6/9] usb: misc: brcmstb-usb-pinmap: add IRQ check From: Sergey Shtylyov To: , Greg Kroah-Hartman , Felipe Balbi References: <47bacc02-4e34-3208-779c-7072a6261782@omp.ru> CC: Al Cooper , Florian Fainelli , , Organization: Open Mobile Platform Message-ID: <806d0b1a-365b-93d9-3fc1-922105ca5e61@omp.ru> Date: Mon, 9 Aug 2021 23:45:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <47bacc02-4e34-3208-779c-7072a6261782@omp.ru> Content-Language: en-US X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210809_134519_470335_8128E7F6 X-CRM114-Status: GOOD ( 13.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: 517c4c44b323 ("usb: Add driver to allow any GPIO to be used for 7211 USB signals") Signed-off-by: Sergey Shtylyov Reviewed-by: Florian Fainelli --- drivers/usb/misc/brcmstb-usb-pinmap.c | 2 ++ 1 file changed, 2 insertions(+) Index: usb/drivers/usb/misc/brcmstb-usb-pinmap.c =================================================================== --- usb.orig/drivers/usb/misc/brcmstb-usb-pinmap.c +++ usb/drivers/usb/misc/brcmstb-usb-pinmap.c @@ -293,6 +293,8 @@ static int __init brcmstb_usb_pinmap_pro /* Enable interrupt for out pins */ irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; err = devm_request_irq(&pdev->dev, irq, brcmstb_usb_pinmap_ovr_isr, IRQF_TRIGGER_RISING,