From: Aditya Pakki Date: Mon, 24 Dec 2018 17:41:54 +0000 (-0600) Subject: dmaengine: mv_xor: Fix a missing check in mv_xor_channel_add X-Git-Tag: v5.1-rc1~32^2~4^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7c97381e7a9a5ec359007c0d491a143e3d9f787c;p=uclinux-h8%2Flinux.git dmaengine: mv_xor: Fix a missing check in mv_xor_channel_add 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 Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index 7f595355fb79..e733c5eeaabc 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -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: