[PATCH 1/5] ARM: mxs: free dma_mask in error path

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Fri Feb 18 16:30:28 EST 2011


From: Lothar Waßmann <LW at KARO-electronics.de>

This fixes a small memory leak that was only hit in very unlikely error
paths.

Signed-off-by: Lothar Waßmann <LW at KARO-electronics.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
 arch/arm/mach-mxs/devices.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mxs/devices.c b/arch/arm/mach-mxs/devices.c
index c20d547..cfdb6b2 100644
--- a/arch/arm/mach-mxs/devices.c
+++ b/arch/arm/mach-mxs/devices.c
@@ -66,6 +66,8 @@ struct platform_device *__init mxs_add_platform_device_dmamask(
 	ret = platform_device_add(pdev);
 	if (ret) {
 err:
+		if (dmamask)
+			kfree(pdev->dev.dma_mask);
 		platform_device_put(pdev);
 		return ERR_PTR(ret);
 	}
-- 
1.7.2.3




More information about the linux-arm-kernel mailing list