From patchwork Thu Aug 3 11:42:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangzhu X-Patchwork-Id: 13339861 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D39EEC04A6A for ; Thu, 3 Aug 2023 11:43:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235405AbjHCLnY (ORCPT ); Thu, 3 Aug 2023 07:43:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233875AbjHCLnS (ORCPT ); Thu, 3 Aug 2023 07:43:18 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B2C81B2; Thu, 3 Aug 2023 04:43:17 -0700 (PDT) Received: from dggpeml500025.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RGn2F0kMQzNmbY; Thu, 3 Aug 2023 19:39:49 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.202) by dggpeml500025.china.huawei.com (7.185.36.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 3 Aug 2023 19:43:15 +0800 From: Zhu Wang To: , , , , , , CC: Subject: [PATCH -next v2] usb: gadget: udc: gr_udc: Do not check 0 for platform_get_irq() Date: Thu, 3 Aug 2023 19:42:46 +0800 Message-ID: <20230803114246.79820-1-wangzhu9@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.202] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500025.china.huawei.com (7.185.36.35) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org When platform_get_irq_byname() is called to get a interrupt number, it may return -EINVAL or -ENXIO when failed, while current code returned -ENODEV, so we replace it with the return value of platform_get_irq_byname(). And we found that platform_get_irq_byname() never returned zero by reading its code. Commit ce753ad1549c ("platform: finally disallow IRQ0 in platform_get_irq() and its ilk") makes sure IRQ0 is not returned. Signed-off-by: Zhu Wang Reviewed-by: Herve Codina --- Changes in v2: - Update the commit message, present the reason of replacing the return value of the probe. --- drivers/usb/gadget/udc/gr_udc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c index 0c3969301a53..c6dfa7cccc11 100644 --- a/drivers/usb/gadget/udc/gr_udc.c +++ b/drivers/usb/gadget/udc/gr_udc.c @@ -2136,15 +2136,15 @@ static int gr_probe(struct platform_device *pdev) return PTR_ERR(regs); dev->irq = platform_get_irq(pdev, 0); - if (dev->irq <= 0) - return -ENODEV; + if (dev->irq < 0) + return dev->irq; /* Some core configurations has separate irqs for IN and OUT events */ dev->irqi = platform_get_irq(pdev, 1); if (dev->irqi > 0) { dev->irqo = platform_get_irq(pdev, 2); - if (dev->irqo <= 0) - return -ENODEV; + if (dev->irqo < 0) + return dev->irqo; } else { dev->irqi = 0; }