staging: lustre: lnet: avoid uninitialized return value
authorArnd Bergmann <arnd@arndb.de>
Tue, 16 Jan 2018 09:34:25 +0000 (10:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Jan 2018 15:06:32 +0000 (16:06 +0100)
commite3675875c0a5132298bdd4b973678901b62c4259
tree709531f75bc259a9769668a6e8b09f53e7170549
parent2b44667b8fb667b9fec4b278285f61aaee26e626
staging: lustre: lnet: avoid uninitialized return value

gcc warns that the latest workqueue change leads to returning an
uninitialized variable:

drivers/staging/lustre/lnet/selftest/module.c: In function 'lnet_selftest_init':
drivers/staging/lustre/lnet/selftest/module.c:98:10: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]

A failure from alloc_ordered_workqueue() tends to indicate an
out-of-memory condition, so return -ENOMEM in both cases.
The second error path was a preexisting bug, where we always
returned zero after a kvmalloc_array() failure.

Fixes: 6106c0f82481 ("staging: lustre: lnet: convert selftest to use workqueues")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/selftest/module.c