diff options
author | Devendra Naga <devendra.aaru@gmail.com> | 2012-09-13 13:08:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-13 20:20:28 -0700 |
commit | 99d4b1a6cbfa8449dad5fb58e8c8044301e2667a (patch) | |
tree | 830e30678508e9d2199e69c3473797280220fa70 /drivers/staging/ccg | |
parent | 43bf2f4bfeb57601a9ccba382e0f378763df4b26 (diff) | |
download | talos-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.c | 4 |
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); |