summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/svc.c
diff options
context:
space:
mode:
authorDavid Lin <dtwlin@google.com>2016-04-22 19:03:43 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2016-04-25 11:13:59 -0700
commit9983ea6b766aa701707e50c4b767ca892ee9ba7d (patch)
tree56429e900177ff2f7ff04682dc49b6769fd92417 /drivers/staging/greybus/svc.c
parent3fd747a63e836baab1739bab7f18d9227a083312 (diff)
greybus: svc: free pwrmon_rails memory upon exit
For every time SVC instance is created, memories for storing the rail IDs are allocated, however, they are not freed when the SVC is destroyed. This patch fixes the memory leak by freeing the memory when debugfs for SVC is no longer needed. Testing Done: - Check pwrmon debugfs after turning on and off SVC Signed-off-by: David Lin <dtwlin@google.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/svc.c')
-rw-r--r--drivers/staging/greybus/svc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c
index b30b2277fa86..78fe4dc37131 100644
--- a/drivers/staging/greybus/svc.c
+++ b/drivers/staging/greybus/svc.c
@@ -650,6 +650,8 @@ static void gb_svc_debugfs_init(struct gb_svc *svc)
static void gb_svc_debugfs_exit(struct gb_svc *svc)
{
debugfs_remove_recursive(svc->debugfs_dentry);
+ kfree(svc->pwrmon_rails);
+ svc->pwrmon_rails = NULL;
}
static int gb_svc_hello(struct gb_operation *op)