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@xxxxxxxxxxxxxxxxxxxx> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx> 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 > -- மணிவண்ணன் சதாசிவம்