Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f06fc9b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

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

parents 809e35f5 340cfc6a
Loading
Loading
Loading
Loading
+25 −11
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@

static void *ffs_ipc_log;
#define ffs_log(fmt, ...) do { \
	if (ffs_ipc_log)	\
		ipc_log_string(ffs_ipc_log, "%s: " fmt,  __func__, \
			##__VA_ARGS__); \
	pr_debug(fmt, ##__VA_ARGS__); \
@@ -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,13 +1620,7 @@ 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 **************/

@@ -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");