projects
/
firefly-linux-kernel-4.4.55.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
43bf2f4
)
staging:ccg: fix a class_destroy when kmalloc fails after the class_create
author
Devendra Naga
<devendra.aaru@gmail.com>
Thu, 13 Sep 2012 17:08:48 +0000
(13:08 -0400)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Fri, 14 Sep 2012 03:20:28 +0000
(20:20 -0700)
we do class_create and call kmalloc to allocate dev pointer,
and if kmalloc fail we forget destoying class
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ccg/ccg.c
patch
|
blob
|
history
diff --git
a/drivers/staging/ccg/ccg.c
b/drivers/staging/ccg/ccg.c
index 81ac6bbba55f5a8ce892499ae2b5bbcd9e4ffdaf..565249b2d7551305c73d2b374dbceb07e043d20a 100644
(file)
--- a/
drivers/staging/ccg/ccg.c
+++ b/
drivers/staging/ccg/ccg.c
@@
-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);