[PATCH] nvme: multipath: fix return value of nvme_available_path

Uday Shankar posted 1 patch 8 months, 2 weeks ago
drivers/nvme/host/multipath.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] nvme: multipath: fix return value of nvme_available_path
Posted by Uday Shankar 8 months, 2 weeks ago
The function returns bool so we should return false, not NULL. No
functional changes are expected.

Signed-off-by: Uday Shankar <ushankar@purestorage.com>
---
 drivers/nvme/host/multipath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 6b12ca80aa27305a759990348c4c107655664d94..94152cf423f165aaba9cbb57f370ef4708365f1a 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -427,7 +427,7 @@ static bool nvme_available_path(struct nvme_ns_head *head)
 	struct nvme_ns *ns;
 
 	if (!test_bit(NVME_NSHEAD_DISK_LIVE, &head->flags))
-		return NULL;
+		return false;
 
 	list_for_each_entry_srcu(ns, &head->list, siblings,
 				 srcu_read_lock_held(&head->srcu)) {

---
base-commit: 0514a1379e11c6b8038674f43a478b0857d47a5e
change-id: 20250404-nvme_type-a8d541eff3da

Best regards,
-- 
Uday Shankar <ushankar@purestorage.com>
Re: [PATCH] nvme: multipath: fix return value of nvme_available_path
Posted by Sagi Grimberg 8 months, 1 week ago
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Re: [PATCH] nvme: multipath: fix return value of nvme_available_path
Posted by Christoph Hellwig 8 months, 2 weeks ago
On Fri, Apr 04, 2025 at 02:06:43PM -0600, Uday Shankar wrote:
> The function returns bool so we should return false, not NULL. No
> functional changes are expected.

Thanks,

applied to nvme-6.15.

I'm a bit surprised this didn't generate a sparse warning similar to
when 0 is used in pointer context, but I guess that is because of the
implicit conversion of boolean expressions to the bool type.