From: Felipe Balbi <balbi@kernel.org>
To: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: linux-usb@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Ludovic Desroches <ludovic.desroches@microchip.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/9] usb: gadget: udc: at91: add IRQ check
Date: Mon, 09 Aug 2021 13:07:39 +0300 [thread overview]
Message-ID: <8735rjkk16.fsf@kernel.org> (raw)
In-Reply-To: <3ebcf6ee-4ca7-d7dc-6e04-62bc4f9e1ead@omp.ru>
Sergey Shtylyov <s.shtylyov@omp.ru> writes:
> The driver neglects to check the result of platform_get_irq()'s call and
> blithely passes the negative error codes to devm_request_irq() (which takes
> *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
> error code. Stop calling devm_request_irq() with the invalid IRQ #s.
>
> Fixes: 8b2e76687b39 ("USB: AT91 UDC updates, mostly power management")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>
> ---
> drivers/usb/gadget/udc/at91_udc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> Index: usb/drivers/usb/gadget/udc/at91_udc.c
> ===================================================================
> --- usb.orig/drivers/usb/gadget/udc/at91_udc.c
> +++ usb/drivers/usb/gadget/udc/at91_udc.c
> @@ -1876,7 +1876,9 @@ static int at91udc_probe(struct platform
> clk_disable(udc->iclk);
>
> /* request UDC and maybe VBUS irqs */
> - udc->udp_irq = platform_get_irq(pdev, 0);
> + udc->udp_irq = retval = platform_get_irq(pdev, 0);
> + if (retval < 0)
> + goto err_unprepare_iclk;
let's avoid multiple assignments in one line. How about:
if (udc->udp_irq < 0) {
retval = udc->udp_irq;
goto err_unprepare_iclk;
}
--
balbi
next prev parent reply other threads:[~2021-08-09 10:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-08 20:30 [PATCH v2 0/9] Stop calling devm_request_irq() with invalid IRQs in the USB drivers Sergey Shtylyov
2021-08-08 20:37 ` [PATCH 1/9] usb: dwc3: meson-g12a: add IRQ check Sergey Shtylyov
2021-08-08 20:50 ` Martin Blumenstingl
2021-08-09 10:08 ` Felipe Balbi
2021-08-08 20:41 ` [PATCH 2/9] usb: dwc3: qcom: " Sergey Shtylyov
2021-08-09 10:07 ` Felipe Balbi
2021-08-08 20:45 ` [PATCH 3/9] usb: gadget: udc: at91: " Sergey Shtylyov
2021-08-09 10:07 ` Felipe Balbi [this message]
2021-08-08 20:57 ` [PATCH 4/9] usb: gadget: udc: s3c2410: " Sergey Shtylyov
2021-08-08 21:01 ` Sergey Shtylyov
2021-08-09 10:09 ` Felipe Balbi
2021-08-13 6:58 ` [PATCH v2 0/9] Stop calling devm_request_irq() with invalid IRQs in the USB drivers Greg Kroah-Hartman
2021-08-13 7:01 ` Greg Kroah-Hartman
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=8735rjkk16.fsf@kernel.org \
--to=balbi@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=nicolas.ferre@microchip.com \
--cc=s.shtylyov@omp.ru \
/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;
as well as URLs for NNTP newsgroup(s).