From patchwork Mon Oct 18 18: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: 12567667 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 64018C433F5 for ; Mon, 18 Oct 2021 18:42:01 +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 30A8161212 for ; Mon, 18 Oct 2021 18:42:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 30A8161212 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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+IY1YoJfO/pV7DTRWsXGGUk+lBDifSpjTgs7rZ2TgjM=; b=Bc6lvuWvhNwC64 lZyB+nRuQyrpVKwGNm5iO6LWjPt4ou9VDIx6eQXtDG7KfC/JnTwO8ADdMTA6CCXo5j0E33q+WXDWd Q8nYpT8r64c/vGUqsTPleR2/m6mneOKwLms437imB9gVFoFysolLi9Z87CJR7XfBdNtxWSORuko8b SODJtjU7UIFPw2wRjj4svRJe1So9AMX3YPCeklv0m1Utj00pKGtJpBX7ujElz6YxaNb2O5YVkaTUo 1Ls8yPwiI1aIulU6mrIWsSKqepsuVOVo5SE/L4ThR7kkr6wFei9p+n/wfl6Nf9zZK5NfuckR8HvJI dmfU+ubmHuG1+a32i1NA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcXYv-00Gng9-6L; Mon, 18 Oct 2021 18:40:41 +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 1mcXY0-00GnOU-0t; Mon, 18 Oct 2021 18:39:48 +0000 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 8531220A8F9B 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 20/22] usb: host: xhci-mtk: deny IRQ0 Date: Mon, 18 Oct 2021 21:39:28 +0300 Message-ID: <20211018183930.8448-21-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211018183930.8448-1-s.shtylyov@omp.ru> References: <20211018183930.8448-1-s.shtylyov@omp.ru> MIME-Version: 1.0 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-20211018_113944_263971_FACA7FA3 X-CRM114-Status: GOOD ( 12.45 ) 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 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");