From: Richard Weinberger Date: Tue, 18 Mar 2014 23:07:05 +0000 (+0100) Subject: staging/xillybus: Handle OOM in xillybus_init() X-Git-Tag: MMI-PSA29.97-13-9~12500^2~86 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3e67dee2f6ae7096802a49a16c79fc6adda3a540;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git staging/xillybus: Handle OOM in xillybus_init() alloc_workqueue() can fail and returns NULL in case of OOM. Handle this case and undo class_create(). Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 2ebaf166038c..b0a6696f2da0 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -2318,8 +2318,12 @@ static int __init xillybus_init(void) } xillybus_wq = alloc_workqueue(xillyname, 0, 0); + if (!xillybus_wq) { + class_destroy(xillybus_class); + rc = -ENOMEM; + } - return 0; /* Success */ + return rc; } static void __exit xillybus_exit(void)