Ver Fonte

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 <helmut.schaa@googlemail.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Helmut Schaa há 11 anos atrás
pai
commit
151d6b21f9
1 ficheiros alterados com 3 adições e 1 exclusões
  1. 3 1
      drivers/mtd/ubi/block.c

+ 3 - 1
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);