dmaengine: mv_xor: Fix a missing check in mv_xor_channel_add
authorAditya Pakki <pakki001@umn.edu>
Mon, 24 Dec 2018 17:41:54 +0000 (11:41 -0600)
committerVinod Koul <vkoul@kernel.org>
Mon, 7 Jan 2019 04:20:29 +0000 (09:50 +0530)
dma_async_device_register() may fail and return an error. The capabilities
checked in mv_xor_channel_add() are not complete. The fix handles the
error by freeing the resources.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/mv_xor.c

index 7f595355fb7936e3b7ef2090987ac08148683426..e733c5eeaabc6ad68ef6c198b291e182966422bf 100644 (file)
@@ -1153,7 +1153,10 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
                 dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask) ? "cpy " : "",
                 dma_has_cap(DMA_INTERRUPT, dma_dev->cap_mask) ? "intr " : "");
 
-       dma_async_device_register(dma_dev);
+       ret = dma_async_device_register(dma_dev);
+       if (ret)
+               goto err_free_irq;
+
        return mv_chan;
 
 err_free_irq: