linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/MSI: Return error code if memory allocation fails
@ 2017-01-27 15:14 Christophe JAILLET
  2017-02-10 20:16 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2017-01-27 15:14 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linux-kernel, kernel-janitors, Christophe JAILLET

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(-)

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PCI/MSI: Return error code if memory allocation fails
  2017-01-27 15:14 [PATCH] PCI/MSI: Return error code if memory allocation fails Christophe JAILLET
@ 2017-02-10 20:16 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2017-02-10 20:16 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: bhelgaas, linux-pci, linux-kernel, kernel-janitors

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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-10 20:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-27 15:14 [PATCH] PCI/MSI: Return error code if memory allocation fails Christophe JAILLET
2017-02-10 20:16 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).