[PATCH 3.16.y-ckt 145/254] rbd: fix error return code in rbd_dev_device_setup()

From: Luis Henriques
Date: Tue Nov 25 2014 - 06:20:19 EST


3.16.7-ckt2 -stable review patch. If anyone has any objections, please let me know.

------------------

From: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>

commit 255939e783d8f45f8c58487dfc18957c44ea9871 upstream.

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@xxxxxxxxxx>
Signed-off-by: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
Cc: Ilya Dryomov <ilya.dryomov@xxxxxxxxxxx>
Signed-off-by: Luis Henriques <luis.henriques@xxxxxxxxxxxxx>
---
drivers/block/rbd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 453afd257530..5c38fe1f4b85 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -5104,8 +5104,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)
--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/