summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2014-03-19 00:07:05 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-03-18 16:22:27 -0700
commit3e67dee2f6ae7096802a49a16c79fc6adda3a540 (patch)
tree9305c78287792254c08c8c7c14a024278960db69
parentb5f87cf913e6005e3d41db01ffa6d71c292271d9 (diff)
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 <richard@nod.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/xillybus/xillybus_core.c6
1 files changed, 5 insertions, 1 deletions
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)