summaryrefslogtreecommitdiffstats
path: root/drivers/staging/ccg
diff options
context:
space:
mode:
authorDevendra Naga <devendra.aaru@gmail.com>2012-09-13 13:08:48 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-13 20:20:28 -0700
commit99d4b1a6cbfa8449dad5fb58e8c8044301e2667a (patch)
tree830e30678508e9d2199e69c3473797280220fa70 /drivers/staging/ccg
parent43bf2f4bfeb57601a9ccba382e0f378763df4b26 (diff)
downloadtalos-op-linux-99d4b1a6cbfa8449dad5fb58e8c8044301e2667a.tar.gz
talos-op-linux-99d4b1a6cbfa8449dad5fb58e8c8044301e2667a.zip
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: Devendra Naga <devendra.aaru@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ccg')
-rw-r--r--drivers/staging/ccg/ccg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/ccg/ccg.c b/drivers/staging/ccg/ccg.c
index 81ac6bbba55f..565249b2d755 100644
--- 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);
OpenPOWER on IntegriCloud