Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1309579

[PATCH 3/5] coresight: coresight_unregister() function cleanup

From Mathieu Poirier <mathieu.poirier@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 3/5] coresight: coresight_unregister() function cleanup
Date 2016-01-14 20:00 +0100
Message-ID <qQVhN-2GT-27@gated-at.bofh.it> (permalink)
References <qQVhM-2GT-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


In its current form the code never frees csdev->refcnt allocated
in coresight_register().  There is also a problem with csdev->conns
that is freed before device_unregister() rather than in the device
release function.

This patch addresses both issues by moving kfree(csdev->conns) to
coresight_device_release() and freeing csdev->refcnt, also in
the same function.

Reported-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 drivers/hwtracing/coresight/coresight.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
index 41b42018b660..8872db4410eb 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -481,6 +481,8 @@ static void coresight_device_release(struct device *dev)
 {
 	struct coresight_device *csdev = to_coresight_device(dev);
 
+	kfree(csdev->conns);
+	kfree(csdev->refcnt);
 	kfree(csdev);
 }
 
@@ -713,7 +715,6 @@ EXPORT_SYMBOL_GPL(coresight_register);
 
 void coresight_unregister(struct coresight_device *csdev)
 {
-	kfree(csdev->conns);
 	device_unregister(&csdev->dev);
 }
 EXPORT_SYMBOL_GPL(coresight_unregister);
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] coresight: miscellaneous fix and cleanup  Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-01-14 20:00 +0100
  [PATCH 2/5] coresight: fixing lockdep error Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-01-14 20:00 +0100
  [PATCH 3/5] coresight: coresight_unregister() function cleanup Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-01-14 20:00 +0100

csiph-web