From 151d6b21f973c585efa052b0ff0fab473ef47831 Mon Sep 17 00:00:00 2001 From: Helmut Schaa Date: Tue, 20 May 2014 11:13:48 +0200 Subject: [PATCH] UBI: block: Fix error path on alloc_workqueue failure Otherwise we'd return a random value if allocation of the workqueue fails. Signed-off-by: Helmut Schaa Acked-by: Brian Norris Signed-off-by: Artem Bityutskiy --- drivers/mtd/ubi/block.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c index 8d659e6a1b4c..389e5f0aee89 100644 --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c @@ -432,8 +432,10 @@ int ubiblock_create(struct ubi_volume_info *vi) * Rembember workqueues are cheap, they're not threads. */ dev->wq = alloc_workqueue("%s", 0, 0, gd->disk_name); - if (!dev->wq) + if (!dev->wq) { + ret = -ENOMEM; goto out_free_queue; + } INIT_WORK(&dev->work, ubiblock_do_work); mutex_lock(&devices_mutex); -- 2.39.5