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>
This commit is contained in:
Richard Weinberger 2014-03-19 00:07:05 +01:00 committed by Greg Kroah-Hartman
parent b5f87cf913
commit 3e67dee2f6

View 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)