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: 12427241 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 17AF9C4338F for ; Mon, 9 Aug 2021 20:21:41 +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 8E1B661040 for ; Mon, 9 Aug 2021 20:21:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8E1B661040 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=uXsdJY4eSJfyK9L/9FwcCgDQDGTWDMluj4gO8HYpkWI=; b=N/kBS/4oSwoaJaXLuXGySqsWIl /m7fq9Jhx/dkkncOD3huZwqU82fX9awjuAca/8xyjY1n8RalRu/gA1W3kKHpYhLPYfyU5kzbi1n8b n8LbsC7HUSXRs8DN5CYAqsFQsKwjMRGyjnA2OKF+av0/8CnkWgzDfw8iKPWwIfQ2rFTj/faEYsfd5 wuPr64gUyRwwv5fLWGGyB694xuX+anvfk3WK0cWt+OXc6RLacPtSjeChJfmb/hZs0KhingzNbgdZh ZK6i9vFJnDS1zBDBOAZfGl1w0OlwTjlxlhCPD0y4a/6o69KV0+qLyTQwhjBFIJ6DO0hEK8axKTzMe cTPog09Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDBm9-001wHg-Lz; Mon, 09 Aug 2021 20:21:33 +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-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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);