linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1
@ 2021-12-21  2:59 Li Chen
  2022-01-04  9:03 ` Kishon Vijay Abraham I
  2022-01-07 10:41 ` Lorenzo Pieralisi
  0 siblings, 2 replies; 3+ messages in thread
From: Li Chen @ 2021-12-21  2:59 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Bjorn Helgaas,
	linux-pci, linux-kernel, Krzysztof Wilczyński

There is no sense to go further if we have no interrupts.

Signed-off-by: Li Chen <lchen@ambarella.com>
---
 drivers/pci/endpoint/pci-epc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 38621558d3975..3bc9273d0a082 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -334,7 +334,7 @@ int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 vfunc_no, u8 interrupts)
 	u8 encode_int;
 
 	if (IS_ERR_OR_NULL(epc) || func_no >= epc->max_functions ||
-	    interrupts > 32)
+	    interrupts < 1 || interrupts > 32)
 		return -EINVAL;
 
 	if (vfunc_no > 0 && (!epc->max_vfs || vfunc_no > epc->max_vfs[func_no]))
-- 
2.34.1

**********************************************************************
This email and attachments contain Ambarella Proprietary and/or Confidential Information and is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorized review, use, disclosure, distribute, copy, or print is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy all copies of the original message. Thank you.

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

* Re: [PATCH] PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1
  2021-12-21  2:59 [PATCH] PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1 Li Chen
@ 2022-01-04  9:03 ` Kishon Vijay Abraham I
  2022-01-07 10:41 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2022-01-04  9:03 UTC (permalink / raw)
  To: Li Chen, Lorenzo Pieralisi, Bjorn Helgaas, linux-pci,
	linux-kernel, Krzysztof Wilczyński



On 21/12/21 8:29 am, Li Chen wrote:
> There is no sense to go further if we have no interrupts.
> 
> Signed-off-by: Li Chen <lchen@ambarella.com>

Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  drivers/pci/endpoint/pci-epc-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> index 38621558d3975..3bc9273d0a082 100644
> --- a/drivers/pci/endpoint/pci-epc-core.c
> +++ b/drivers/pci/endpoint/pci-epc-core.c
> @@ -334,7 +334,7 @@ int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 vfunc_no, u8 interrupts)
>  	u8 encode_int;
>  
>  	if (IS_ERR_OR_NULL(epc) || func_no >= epc->max_functions ||
> -	    interrupts > 32)
> +	    interrupts < 1 || interrupts > 32)
>  		return -EINVAL;
>  
>  	if (vfunc_no > 0 && (!epc->max_vfs || vfunc_no > epc->max_vfs[func_no]))
> 

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

* Re: [PATCH] PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1
  2021-12-21  2:59 [PATCH] PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1 Li Chen
  2022-01-04  9:03 ` Kishon Vijay Abraham I
@ 2022-01-07 10:41 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2022-01-07 10:41 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci, Li Chen, Krzysztof Wilczyński,
	linux-kernel, Kishon Vijay Abraham I
  Cc: Lorenzo Pieralisi

On Tue, 21 Dec 2021 02:59:56 +0000, Li Chen wrote:
> There is no sense to go further if we have no interrupts.
> 
> 

Applied to pci/endpoint, thanks!

[1/1] PCI: endpoint: Return -EINVAL when interrupts num is smaller than 1
      https://git.kernel.org/lpieralisi/pci/c/50b620303a

Thanks,
Lorenzo

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

end of thread, other threads:[~2022-01-07 10:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21  2:59 [PATCH] PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1 Li Chen
2022-01-04  9:03 ` Kishon Vijay Abraham I
2022-01-07 10:41 ` Lorenzo Pieralisi

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