Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a478b097 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Tejun Heo
Browse files

ahci: fix nvec check



commit 17a51f12 ("ahci: only try to use multi-MSI mode if there is more
than 1 port") lead to a case where nvec isn't initialized before it's
used.  Fix this by moving the check into the n_ports conditional.

Reported-and-reviewed-by Colin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 17a51f12
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -1436,14 +1436,14 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
				"ahci: MRSM is on, fallback to single MSI\n");
			pci_free_irq_vectors(pdev);
		}
	}

		/*
	 * -ENOSPC indicated we don't have enough vectors.  Don't bother trying
	 * a single vectors for any other error:
		 * -ENOSPC indicated we don't have enough vectors.  Don't bother
		 * trying a single vectors for any other error:
		 */
		if (nvec < 0 && nvec != -ENOSPC)
			return nvec;
	}

	/*
	 * If the host is not capable of supporting per-port vectors, fall