All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miaoqian Lin <linmq006@gmail.com>
To: "Vinod Koul" <vkoul@kernel.org>,
	"Andreas Färber" <afaerber@suse.de>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: linmq006@gmail.com
Subject: [PATCH] dmaengine: owl-dma: Add missing IRQ check in owl_dma_probe
Date: Fri, 28 Jan 2022 16:37:27 +0000	[thread overview]
Message-ID: <20220128163728.21255-1-linmq006@gmail.com> (raw)

This func misses checking for platform_get_irq()'s call and may passes the
negative error codes to request_threaded_irq(), which takes unsigned IRQ #,
causing it to fail with -EINVAL, overriding an original error code.
Stop calling request_threaded_irq() with invalid IRQ #s.

Fixes: 47e20577c24d ("dmaengine: Add Actions Semi Owl family S900 DMA driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/dma/owl-dma.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c
index 1f0bbaed4643..09cdaecee635 100644
--- a/drivers/dma/owl-dma.c
+++ b/drivers/dma/owl-dma.c
@@ -1160,6 +1160,11 @@ static int owl_dma_probe(struct platform_device *pdev)
 	 * simplification.
 	 */
 	od->irq = platform_get_irq(pdev, 0);
+	if (od->irq < 0) {
+		dev_err(&pdev->dev, "unable to get IRQ\n");
+		return od->irq;
+	}
+
 	ret = devm_request_irq(&pdev->dev, od->irq, owl_dma_interrupt, 0,
 			       dev_name(&pdev->dev), od);
 	if (ret) {
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Miaoqian Lin <linmq006@gmail.com>
To: "Vinod Koul" <vkoul@kernel.org>,
	"Andreas Färber" <afaerber@suse.de>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: linmq006@gmail.com
Subject: [PATCH] dmaengine: owl-dma: Add missing IRQ check in owl_dma_probe
Date: Fri, 28 Jan 2022 16:37:27 +0000	[thread overview]
Message-ID: <20220128163728.21255-1-linmq006@gmail.com> (raw)

This func misses checking for platform_get_irq()'s call and may passes the
negative error codes to request_threaded_irq(), which takes unsigned IRQ #,
causing it to fail with -EINVAL, overriding an original error code.
Stop calling request_threaded_irq() with invalid IRQ #s.

Fixes: 47e20577c24d ("dmaengine: Add Actions Semi Owl family S900 DMA driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/dma/owl-dma.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c
index 1f0bbaed4643..09cdaecee635 100644
--- a/drivers/dma/owl-dma.c
+++ b/drivers/dma/owl-dma.c
@@ -1160,6 +1160,11 @@ static int owl_dma_probe(struct platform_device *pdev)
 	 * simplification.
 	 */
 	od->irq = platform_get_irq(pdev, 0);
+	if (od->irq < 0) {
+		dev_err(&pdev->dev, "unable to get IRQ\n");
+		return od->irq;
+	}
+
 	ret = devm_request_irq(&pdev->dev, od->irq, owl_dma_interrupt, 0,
 			       dev_name(&pdev->dev), od);
 	if (ret) {
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2022-01-28 16:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 16:37 Miaoqian Lin [this message]
2022-01-28 16:37 ` [PATCH] dmaengine: owl-dma: Add missing IRQ check in owl_dma_probe Miaoqian Lin

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=20220128163728.21255-1-linmq006@gmail.com \
    --to=linmq006@gmail.com \
    --cc=afaerber@suse.de \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-actions@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=vkoul@kernel.org \
    /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.