All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhu Wang <wangzhu9@huawei.com>
To: <gregkh@linuxfoundation.org>, <herve.codina@bootlin.com>,
	<stern@rowland.harvard.edu>, <robh@kernel.org>,
	<aaro.koskinen@iki.fi>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <wangzhu9@huawei.com>
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	[thread overview]
Message-ID: <20230803114246.79820-1-wangzhu9@huawei.com> (raw)

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 <wangzhu9@huawei.com>

---
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;
 	}
-- 
2.17.1


             reply	other threads:[~2023-08-03 11:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03 11:42 Zhu Wang [this message]
2023-08-03 11:55 ` [PATCH -next v2] usb: gadget: udc: gr_udc: Do not check 0 for platform_get_irq() Herve Codina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230803114246.79820-1-wangzhu9@huawei.com \
    --to=wangzhu9@huawei.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=gregkh@linuxfoundation.org \
    --cc=herve.codina@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.