staging/xillybus: Handle OOM in xillybus_init()
authorRichard Weinberger <richard@nod.at>
Tue, 18 Mar 2014 23:07:05 +0000 (00:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Mar 2014 23:22:27 +0000 (16:22 -0700)
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>
drivers/staging/xillybus/xillybus_core.c

index 2ebaf166038c6e939435f19e1386e752b12bf356..b0a6696f2da02949c61762cd493618b8e2da57ac 100644 (file)
@@ -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)
This page took 0.025258 seconds and 5 git commands to generate.