Merge "usb: gadget: f_fs: Do not free IPC log buffer when free instance"

This commit is contained in:
Linux Build Service Account 2017-09-15 18:12:40 -07:00 committed by Gerrit - the friendly Code Review server
commit 3f06fc9b4a

View file

@ -46,7 +46,8 @@
static void *ffs_ipc_log;
#define ffs_log(fmt, ...) do { \
ipc_log_string(ffs_ipc_log, "%s: " fmt, __func__, \
if (ffs_ipc_log) \
ipc_log_string(ffs_ipc_log, "%s: " fmt, __func__, \
##__VA_ARGS__); \
pr_debug(fmt, ##__VA_ARGS__); \
} while (0)
@ -1610,10 +1611,6 @@ static int functionfs_init(void)
else
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;
}
@ -1623,14 +1620,8 @@ 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;
}
}
/* ffs_data and ffs_function construction and destruction code **************/
static void ffs_data_clear(struct ffs_data *ffs);
@ -4063,5 +4054,28 @@ static char *ffs_prepare_buffer(const char __user *buf, size_t len)
}
DECLARE_USB_FUNCTION_INIT(ffs, ffs_alloc_inst, ffs_alloc);
static int ffs_init(void)
{
ffs_ipc_log = ipc_log_context_create(NUM_PAGES, "f_fs", 0);
if (IS_ERR_OR_NULL(ffs_ipc_log)) {
ffs_ipc_log = NULL;
pr_err("%s: Create IPC log context failure\n",
__func__);
}
return 0;
}
module_init(ffs_init);
static void __exit ffs_exit(void)
{
if (ffs_ipc_log) {
ipc_log_context_destroy(ffs_ipc_log);
ffs_ipc_log = NULL;
}
}
module_exit(ffs_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Michal Nazarewicz");