diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 263161cb8ac0..7d212f6e865d 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -409,6 +409,8 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head) min_depth_opt = depth; best_opt = ns; } + if (min_depth_opt == 0) + goto out; break; case NVME_ANA_NONOPTIMIZED: if (depth < min_depth_nonopt) { @@ -419,11 +421,8 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head) default: break; } - - if (min_depth_opt == 0) - return best_opt; } - +out: return best_opt ? best_opt : best_nonopt; }