[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1364428524-13821-1-git-send-email-epure.andrei@gmail.com>
Date: Thu, 28 Mar 2013 01:55:24 +0200
From: Andrei Epure <epure.andrei@...il.com>
To: linux@...sktech.co.nz, FlorianSchandinat@....de,
linux-arm-kernel@...ts.infradead.org
Cc: linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Andrei Epure <epure.andrei@...il.com>
Subject: [PATCH] video: fix invalid free of devm_ allocated data
The objects allocated by devm_* APIs are managed by devres and are freed when
the device is detached. Hence there is no need to use kfree() explicitly.
Patch found using coccinelle.
Signed-off-by: Andrei Epure <epure.andrei@...il.com>
---
drivers/video/vt8500lcdfb.c | 3 ---
drivers/video/wm8505fb.c | 3 ---
2 files changed, 6 deletions(-)
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c
index b4ccca2..ea3ee61 100644
--- a/drivers/video/vt8500lcdfb.c
+++ b/drivers/video/vt8500lcdfb.c
@@ -465,7 +465,6 @@ failed_free_res:
release_mem_region(res->start, resource_size(res));
failed_fbi:
platform_set_drvdata(pdev, NULL);
- kfree(fbi);
failed:
return ret;
}
@@ -494,8 +493,6 @@ static int vt8500lcd_remove(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(res->start, resource_size(res));
- kfree(fbi);
-
return 0;
}
diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
index 2e8298e..34a2de1 100644
--- a/drivers/video/wm8505fb.c
+++ b/drivers/video/wm8505fb.c
@@ -427,7 +427,6 @@ failed_free_res:
release_mem_region(res->start, resource_size(res));
failed_fbi:
platform_set_drvdata(pdev, NULL);
- kfree(fbi);
failed:
return ret;
}
@@ -451,8 +450,6 @@ static int wm8505fb_remove(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(res->start, resource_size(res));
- kfree(fbi);
-
return 0;
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists