lkml.org 
[lkml]   [2022]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH RESEND v5 02/24] dmaengine: dw-edma: Release requested IRQs on failure
    Date
    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@baikalelectronics.ru>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Acked-By: Vinod Koul <vkoul@kernel.org>

    ---

    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
    \
     
     \ /
      Last update: 2022-08-22 20:58    [W:4.161 / U:1.124 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site