[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220512143900.GH35848@thinkpad>
Date: Thu, 12 May 2022 20:09:00 +0530
From: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To: Serge Semin <Sergey.Semin@...kalelectronics.ru>
Cc: Gustavo Pimentel <gustavo.pimentel@...opsys.com>,
Vinod Koul <vkoul@...nel.org>,
Jingoo Han <jingoohan1@...il.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Frank Li <Frank.Li@....com>,
Serge Semin <fancer.lancer@...il.com>,
Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
Pavel Parkhomenko <Pavel.Parkhomenko@...kalelectronics.ru>,
Rob Herring <robh@...nel.org>,
Krzysztof Wilczyński <kw@...ux.com>,
linux-pci@...r.kernel.org, dmaengine@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 03/26] dmaengine: dw-edma: Release requested IRQs on
failure
On Wed, May 04, 2022 at 01:50:41AM +0300, Serge Semin wrote:
> From very beginning of the DW eDMA driver live in the kernel the method
> dw_edma_irq_request() hasn't been designed quite correct. In case if the
> request_irq() method fails to initialize the IRQ handler at some point the
> previously requested IRQs will be left initialized. It's prune to errors
> up to the system crash. Let's fix that by releasing the previously
> requested IRQs in the cleanup-on-error path of the dw_edma_irq_request()
> function.
>
> Fixes: e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver")
> Signed-off-by: Serge Semin <Sergey.Semin@...kalelectronics.ru>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Thanks,
Mani
>
> ---
>
> Changelog v2:
> - This is a new patch added in v2 iteration of the series.
> ---
> drivers/dma/dw-edma/dw-edma-core.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index 07f756479663..04efcb16d13d 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
> @@ -899,10 +899,8 @@ static int dw_edma_irq_request(struct dw_edma *dw,
> dw_edma_interrupt_read,
> IRQF_SHARED, dw->name,
> &dw->irq[i]);
> - if (err) {
> - dw->nr_irqs = i;
> - return err;
> - }
> + if (err)
> + goto err_irq_free;
>
> if (irq_get_msi_desc(irq))
> get_cached_msi_msg(irq, &dw->irq[i].msi);
> @@ -911,6 +909,14 @@ static int dw_edma_irq_request(struct dw_edma *dw,
> dw->nr_irqs = i;
> }
>
> + return 0;
> +
> +err_irq_free:
> + for (i--; i >= 0; i--) {
> + irq = chip->ops->irq_vector(dev, i);
> + free_irq(irq, &dw->irq[i]);
> + }
> +
> return err;
> }
>
> --
> 2.35.1
>
--
மணிவண்ணன் சதாசிவம்
Powered by blists - more mailing lists