Patchwork dma/mv_xor: Fix a missing check in mv_xor_channel_add

login
register
mail settings
Submitter Aditya Pakki
Date Dec. 24, 2018, 5:41 p.m.
Message ID <20181224174154.19904-1-pakki001@umn.edu>
Download mbox | patch
Permalink /patch/689417/
State New
Headers show

Comments

Aditya Pakki - Dec. 24, 2018, 5:41 p.m.
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>
---
 drivers/dma/mv_xor.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Vinod Koul - Jan. 4, 2019, 2:36 p.m.
On 24-12-18, 11:41, Aditya Pakki wrote:
> 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.

Applied after fixing subsystem tag, thanks

Patch

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: