[PATCH 4.9 29/67] PCI/MSI: Return failure when msix_setup_entries() fails

From: Greg Kroah-Hartman
Date: Mon Nov 06 2017 - 05:10:41 EST


4.9-stable review patch. If anyone has any objections, please let me know.

------------------

From: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>


[ Upstream commit 3adfb572f2978a980b250a9e1a56f84f3a031001 ]

If alloc_msi_entry() fails, we free resources and set ret = -ENOMEM.

However, msix_setup_entries() returns 0 unconditionally. Return the error
code instead.

Fixes: e75eafb9b039 ("genirq/msi: Switch to new irq spreading infrastructure")
Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/pci/msi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -730,7 +730,7 @@ static int msix_setup_entries(struct pci
ret = 0;
out:
kfree(masks);
- return 0;
+ return ret;
}

static void msix_program_entries(struct pci_dev *dev,