diff options
author | Mathieu Poirier <mathieu.poirier@linaro.org> | 2016-02-02 14:13:57 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-07 22:11:10 -0800 |
commit | fae54158792aec705620bdc3938d342879204f0c (patch) | |
tree | 60526b16e8c3c78cefcf772e5dd5e1bafd191c5f /drivers/hwtracing/coresight/coresight.c | |
parent | a9ddc71f5840c2711e530f2e055b278f79948b29 (diff) | |
download | talos-obmc-linux-fae54158792aec705620bdc3938d342879204f0c.tar.gz talos-obmc-linux-fae54158792aec705620bdc3938d342879204f0c.zip |
coresight: coresight_unregister() function cleanup
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing/coresight/coresight.c')
-rw-r--r-- | drivers/hwtracing/coresight/coresight.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); |