diff mbox series

PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1

Message ID CH2PR19MB402491B9E503694DBCAC6005A07C9@CH2PR19MB4024.namprd19.prod.outlook.com
State New
Headers show
Series PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1 | expand

Commit Message

Li Chen Dec. 21, 2021, 2:59 a.m. UTC
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(-)

Comments

Kishon Vijay Abraham I Jan. 4, 2022, 9:03 a.m. UTC | #1
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]))
>
Lorenzo Pieralisi Jan. 7, 2022, 10:41 a.m. UTC | #2
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
diff mbox series

Patch

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