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

Commit 1037b278 authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Greg Kroah-Hartman
Browse files

char: misc: fix error path



Lets call remove_proc_entry() in the error path only if we have
successfully created "misc" in procfs.

Signed-off-by: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 344e62b3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -281,8 +281,9 @@ static char *misc_devnode(struct device *dev, umode_t *mode)
static int __init misc_init(void)
{
	int err;
	struct proc_dir_entry *ret;

	proc_create("misc", 0, NULL, &misc_proc_fops);
	ret = proc_create("misc", 0, NULL, &misc_proc_fops);
	misc_class = class_create(THIS_MODULE, "misc");
	err = PTR_ERR(misc_class);
	if (IS_ERR(misc_class))
@@ -298,6 +299,7 @@ static int __init misc_init(void)
	printk("unable to get major %d for misc devices\n", MISC_MAJOR);
	class_destroy(misc_class);
fail_remove:
	if (ret)
		remove_proc_entry("misc", NULL);
	return err;
}