diff mbox series

[RFT] dmaengine: fsl-qdma: Handle invalid qdma-queue0 IRQ

Message ID 20191004150826.6656-1-krzk@kernel.org (mailing list archive)
State Accepted
Headers show
Series [RFT] dmaengine: fsl-qdma: Handle invalid qdma-queue0 IRQ | expand

Commit Message

Krzysztof Kozlowski Oct. 4, 2019, 3:08 p.m. UTC
platform_get_irq_byname() might return -errno which later would be cast
to an unsigned int and used in IRQ handling code leading to usage of
wrong ID and errors about wrong irq_base.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Not marking as cc-stable as this was not reproduced and not tested.
---
 drivers/dma/fsl-qdma.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Peng Ma Oct. 21, 2019, 9:54 a.m. UTC | #1
Hi Krzysztof,

Thanks for your patch.
Reviewed-by: Peng Ma <peng.ma@nxp.com>
Tested-by: Peng Ma <peng.ma@nxp.com>

Best Regards,
Peng
>-----Original Message-----
>From: Krzysztof Kozlowski <krzk@kernel.org>
>Sent: 2019年10月4日 23:08
>To: Vinod Koul <vkoul@kernel.org>; Dan Williams <dan.j.williams@intel.com>;
>Peng Ma <peng.ma@nxp.com>; Wen He <wen.he_1@nxp.com>; Jiaheng Fan
><jiaheng.fan@nxp.com>; Krzysztof Kozlowski <krzk@kernel.org>;
>dmaengine@vger.kernel.org; linux-kernel@vger.kernel.org
>Subject: [EXT] [RFT] dmaengine: fsl-qdma: Handle invalid qdma-queue0 IRQ
>
>Caution: EXT Email
>
>platform_get_irq_byname() might return -errno which later would be cast to an
>unsigned int and used in IRQ handling code leading to usage of wrong ID and
>errors about wrong irq_base.
>
>Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
>
>---
>
>Not marking as cc-stable as this was not reproduced and not tested.
>---
> drivers/dma/fsl-qdma.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c index
>06664fbd2d91..89792083d62c 100644
>--- a/drivers/dma/fsl-qdma.c
>+++ b/drivers/dma/fsl-qdma.c
>@@ -1155,6 +1155,9 @@ static int fsl_qdma_probe(struct platform_device
>*pdev)
>                return ret;
>
>        fsl_qdma->irq_base = platform_get_irq_byname(pdev,
>"qdma-queue0");
>+       if (fsl_qdma->irq_base < 0)
>+               return fsl_qdma->irq_base;
>+
>        fsl_qdma->feature = of_property_read_bool(np, "big-endian");
>        INIT_LIST_HEAD(&fsl_qdma->dma_dev.channels);
>
>--
>2.17.1
Vinod Koul Nov. 2, 2019, 4:26 p.m. UTC | #2
On 04-10-19, 17:08, Krzysztof Kozlowski wrote:
> platform_get_irq_byname() might return -errno which later would be cast
> to an unsigned int and used in IRQ handling code leading to usage of
> wrong ID and errors about wrong irq_base.

Applied, thanks
diff mbox series

Patch

diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c
index 06664fbd2d91..89792083d62c 100644
--- a/drivers/dma/fsl-qdma.c
+++ b/drivers/dma/fsl-qdma.c
@@ -1155,6 +1155,9 @@  static int fsl_qdma_probe(struct platform_device *pdev)
 		return ret;
 
 	fsl_qdma->irq_base = platform_get_irq_byname(pdev, "qdma-queue0");
+	if (fsl_qdma->irq_base < 0)
+		return fsl_qdma->irq_base;
+
 	fsl_qdma->feature = of_property_read_bool(np, "big-endian");
 	INIT_LIST_HEAD(&fsl_qdma->dma_dev.channels);