diff options
author | Richard Weinberger <richard@nod.at> | 2014-03-19 03:07:05 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-19 03:22:27 +0400 |
commit | 3e67dee2f6ae7096802a49a16c79fc6adda3a540 (patch) | |
tree | 9305c78287792254c08c8c7c14a024278960db69 /drivers/staging/xillybus | |
parent | b5f87cf913e6005e3d41db01ffa6d71c292271d9 (diff) | |
download | linux-3e67dee2f6ae7096802a49a16c79fc6adda3a540.tar.xz |
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>
Diffstat (limited to 'drivers/staging/xillybus')
-rw-r--r-- | drivers/staging/xillybus/xillybus_core.c | 6 |
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) |