Skip to contentSkip to conversation

UBI: block: checking for NULL instead of IS_ERR()

PATCH Applied Dan Carpenter 2 participants 2 messages Feb 5, 2015 – Feb 12, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 UBI: block: checking for NULL instead of IS_ERR()

We recently switched from allocating ->rq using blk_init_queue() to use blk_mq_init_queue() so we need to update the error handling to check for IS_ERR() instead of NULL.

Fixes ff1f48ee3bb3 ('UBI: Block: Add blk-mq support')
drivers/mtd/ubi/block.c +2 -2
index 995e61c..d0a9349 100644
@@ -409,9 +409,9 @@ int ubiblock_create(struct ubi_volume_info *vi)
 	}
 
 	dev->rq = blk_mq_init_queue(&dev->tag_set);
-	if (!dev->rq) {
+	if (IS_ERR(dev->rq)) {
 		dev_err(disk_to_dev(gd), "blk_mq_init_queue failed");
-		ret = -ENODEV;
+		ret = PTR_ERR(dev->rq);
 		goto out_free_tags;
 	}
 	blk_queue_max_segments(dev->rq, UBI_MAX_SG_COUNT);
maintainer Applied
#1 lore raw

Am 05.02.2015 um 08:38 schrieb Dan Carpenter:

Quoted 13 lines

We recently switched from allocating ->rq using blk_init_queue() to use blk_mq_init_queue() so we need to update the error handling to check for IS_ERR() instead of NULL.

Fixes ff1f48ee3bb3 ('UBI: Block: Add blk-mq support')
drivers/mtd/ubi/block.c +0 -0
index 995e61c..d0a9349 100644
@@ -409,9 +409,9 @@ int ubiblock_create(struct ubi_volume_info *vi)
 	}

drivers/mtd/ubi/block.c int ubiblock_create(struct ubi_volume_info *vi) · line 417

Quoted 10 lines
drivers/mtd/ubi/block.c +2 -2
 
 	dev->rq = blk_mq_init_queue(&dev->tag_set);
-	if (!dev->rq) {
+	if (IS_ERR(dev->rq)) {
 		dev_err(disk_to_dev(gd), "blk_mq_init_queue failed");
-		ret = -ENODEV;
+		ret = PTR_ERR(dev->rq);
 		goto out_free_tags;
 	}
 	blk_queue_max_segments(dev->rq, UBI_MAX_SG_COUNT);

Applied. Thanks Dan!