summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun2014-08-14 05:49:52 +0200
committerIlya Dryomov2014-09-10 09:59:06 +0200
commit255939e783d8f45f8c58487dfc18957c44ea9871 (patch)
treeb0d0c8e422e09fa79d0deb9ee2292b6e4cc3e856
parentrbd: avoid format-security warning inside alloc_workqueue() (diff)
downloadkernel-qcow2-linux-255939e783d8f45f8c58487dfc18957c44ea9871.tar.gz
kernel-qcow2-linux-255939e783d8f45f8c58487dfc18957c44ea9871.tar.xz
kernel-qcow2-linux-255939e783d8f45f8c58487dfc18957c44ea9871.zip
rbd: fix error return code in rbd_dev_device_setup()
Fix to return -ENOMEM from the workqueue alloc error handling case instead of 0, as done elsewhere in this function. Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
-rw-r--r--drivers/block/rbd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 2cd01ca1b5b4..4b97baf8afa3 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -5088,8 +5088,10 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev)
set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only);
rbd_dev->rq_wq = alloc_workqueue("%s", 0, 0, rbd_dev->disk->disk_name);
- if (!rbd_dev->rq_wq)
+ if (!rbd_dev->rq_wq) {
+ ret = -ENOMEM;
goto err_out_mapping;
+ }
ret = rbd_bus_add_dev(rbd_dev);
if (ret)