From: Dan Carpenter <dan.carpenter@linaro.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Rob Herring" <robh@kernel.org>,
"Felipe Balbi" <felipe.balbi@linux.intel.com>,
"Raviteja Garimella" <raviteja.garimella@broadcom.com>,
linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] usb: gadget/snps_udc_plat: Fix a signedness bug in probe
Date: Tue, 6 Jun 2023 11:19:46 +0300 [thread overview]
Message-ID: <ZH7sIkbSZg1rAJpJ@moroto> (raw)
The irq_of_parse_and_map() function returns negative error codes
but "udc->irq" is an unsigned int so the error handling doesn't work.
Fixes: 1b9f35adb0ff ("usb: gadget: udc: Add Synopsys UDC Platform driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/usb/gadget/udc/snps_udc_plat.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c b/drivers/usb/gadget/udc/snps_udc_plat.c
index 0ed685db149d..37edd6c35077 100644
--- a/drivers/usb/gadget/udc/snps_udc_plat.c
+++ b/drivers/usb/gadget/udc/snps_udc_plat.c
@@ -103,7 +103,7 @@ static int udc_plat_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct resource *res;
struct udc *udc;
- int ret;
+ int irq, ret;
udc = devm_kzalloc(dev, sizeof(*udc), GFP_KERNEL);
if (!udc)
@@ -132,11 +132,12 @@ static int udc_plat_probe(struct platform_device *pdev)
udc->phys_addr = (unsigned long)res->start;
- udc->irq = irq_of_parse_and_map(dev->of_node, 0);
- if (udc->irq <= 0) {
+ irq = irq_of_parse_and_map(dev->of_node, 0);
+ if (irq <= 0) {
dev_err(dev, "Can't parse and map interrupt\n");
return -EINVAL;
}
+ udc->irq = irq;
udc->udc_phy = devm_of_phy_get_by_index(dev, dev->of_node, 0);
if (IS_ERR(udc->udc_phy)) {
--
2.30.2
next reply other threads:[~2023-06-06 8:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 8:19 Dan Carpenter [this message]
2023-06-06 9:13 ` [PATCH] usb: gadget/snps_udc_plat: Fix a signedness bug in probe Uwe Kleine-König
2023-06-06 9:41 ` Dan Carpenter
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=ZH7sIkbSZg1rAJpJ@moroto \
--to=dan.carpenter@linaro.org \
--cc=felipe.balbi@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=raviteja.garimella@broadcom.com \
--cc=robh@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox