summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHemant Kumar <hemantk@codeaurora.org>2017-02-28 18:15:48 -0800
committerHemant Kumar <hemantk@codeaurora.org>2017-02-28 18:54:06 -0800
commitab8f94b1da5a32c83fcc02dd3436a62c8bbb4367 (patch)
tree4eee2e0c733de9ac121ccd5b92813b622a5ff358
parent3bf75ddd22dc6e7303e962a262c8d64e5ab87b15 (diff)
usb: gadget: f_fs: Fix memory leak for ipc_log_context
Driver is not calling ipc_log_context_destroy in driver cleanup which leaves the context allocated. Change-Id: Ic1a74b530836d142c9f1db2143b5700e8b6c3321 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
-rw-r--r--drivers/usb/gadget/function/f_fs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 739cf9790cd4..ab44bd316217 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1581,6 +1581,8 @@ static int functionfs_init(void)
pr_err("failed registering file system (%d)\n", ret);
ffs_ipc_log = ipc_log_context_create(NUM_PAGES, "f_fs", 0);
+ if (IS_ERR_OR_NULL(ffs_ipc_log))
+ ffs_ipc_log = NULL;
return ret;
}
@@ -1591,6 +1593,11 @@ static void functionfs_cleanup(void)
pr_info("unloading\n");
unregister_filesystem(&ffs_fs_type);
+
+ if (ffs_ipc_log) {
+ ipc_log_context_destroy(ffs_ipc_log);
+ ffs_ipc_log = NULL;
+ }
}