[patch] NVMe: return an error code if blk_mq_alloc_tag_set() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the current code, if blk_mq_alloc_tag_set() fails then it returns
zero (success) instead of preserving the error code.  The caller is not
expecting that and the kernel could be left in an inconsistent state.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
Static analysis stuff.  Not tested.

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index cb529e9..2ff5efc 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2152,7 +2152,8 @@ static int nvme_dev_add(struct nvme_dev *dev)
 	dev->tagset.flags = BLK_MQ_F_SHOULD_MERGE;
 	dev->tagset.driver_data = dev;
 
-	if (blk_mq_alloc_tag_set(&dev->tagset))
+	res = blk_mq_alloc_tag_set(&dev->tagset);
+	if (res)
 		goto out;
 
 	id_ns = mem;
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux