[PATCH] UBI: block: Fix error path on alloc_workqueue failure
Helmut Schaa
helmut.schaa at googlemail.com
Tue May 20 02:13:48 PDT 2014
Otherwise we'd return a random value if allocation of the workqueue fails.
Signed-off-by: Helmut Schaa <helmut.schaa at googlemail.com>
---
Just stumbled over that one while playing with UBI block devices.
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 8d659e6..389e5f0 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);
--
1.8.4.5
More information about the linux-mtd
mailing list