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

Commit 99d4b1a6 authored by Devendra Naga's avatar Devendra Naga Committed by Greg Kroah-Hartman
Browse files

staging:ccg: fix a class_destroy when kmalloc fails after the class_create



we do class_create and call kmalloc to allocate dev pointer,
and if kmalloc fail we forget destoying class

Signed-off-by: default avatarDevendra Naga <devendra.aaru@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 43bf2f4b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1254,8 +1254,10 @@ static int __init init(void)
		return PTR_ERR(ccg_class);

	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
	if (!dev)
	if (!dev) {
		class_destroy(ccg_class);
		return -ENOMEM;
	}

	dev->functions = supported_functions;
	INIT_LIST_HEAD(&dev->enabled_functions);