Re: [PATCH] PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1

From: Kishon Vijay Abraham I
Date: Tue Jan 04 2022 - 04:03:38 EST




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@xxxxxxxxxxxxx>

Reviewed-by: Kishon Vijay Abraham I <kishon@xxxxxx>
> ---
> 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]))
>