[PATCH] vme: ca91cx42: fix memleak in ca91cx42_dma_list_add

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When we encounter invalid data width or address space,
entry should be freed just like what we've done in the
previous error paths.

Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
---
 drivers/vme/bridges/vme_ca91cx42.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
index ea938dc29c5e..1c464afd9d4e 100644
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ b/drivers/vme/bridges/vme_ca91cx42.c
@@ -1100,7 +1100,8 @@ static int ca91cx42_dma_list_add(struct vme_dma_list *list,
 		break;
 	default:
 		dev_err(dev, "Invalid data width\n");
-		return -EINVAL;
+		retval = -EINVAL;
+		goto err_cycle;
 	}
 
 	/* Setup address space */
@@ -1122,8 +1123,8 @@ static int ca91cx42_dma_list_add(struct vme_dma_list *list,
 		break;
 	default:
 		dev_err(dev, "Invalid address space\n");
-		return -EINVAL;
-		break;
+		retval = -EINVAL;
+		goto err_cycle;
 	}
 
 	if (vme_attr->cycle & VME_SUPER)
-- 
2.17.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux