diff mbox

PCI/MSI: Return error code if memory allocation fails

Message ID 20170127151453.27571-1-christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Christophe JAILLET Jan. 27, 2017, 3:14 p.m. UTC
If 'alloc_msi_entry()' fails, a few lines above, we free resources and set
'ret = -ENOMEM'.

However, the function returns 0, inconditionaly.
Returns the error code instead.

Fixes: e75eafb9b039 ("genirq/msi: Switch to new irq spreading infrastructure")

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/pci/msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bjorn Helgaas Feb. 10, 2017, 8:16 p.m. UTC | #1
On Fri, Jan 27, 2017 at 04:14:53PM +0100, Christophe JAILLET wrote:
> If 'alloc_msi_entry()' fails, a few lines above, we free resources and set
> 'ret = -ENOMEM'.
> 
> However, the function returns 0, inconditionaly.
> Returns the error code instead.
> 
> Fixes: e75eafb9b039 ("genirq/msi: Switch to new irq spreading infrastructure")
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied to pci/msi for v4.11, thanks!

> ---
>  drivers/pci/msi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index b6785c8be44d..0f77b38f03dd 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -731,7 +731,7 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base,
>  	ret = 0;
>  out:
>  	kfree(masks);
> -	return 0;
> +	return ret;
>  }
>  
>  static void msix_program_entries(struct pci_dev *dev,
> -- 
> 2.9.3
>
diff mbox

Patch

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index b6785c8be44d..0f77b38f03dd 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -731,7 +731,7 @@  static int msix_setup_entries(struct pci_dev *dev, void __iomem *base,
 	ret = 0;
 out:
 	kfree(masks);
-	return 0;
+	return ret;
 }
 
 static void msix_program_entries(struct pci_dev *dev,