aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/endpoint
diff options
context:
space:
mode:
authorLi Chen <lchen@ambarella.com>2021-12-21 02:59:56 +0000
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2022-01-07 10:35:34 +0000
commit50b620303a14e885529410d26800f92a735724d6 (patch)
treee68dd695cb65166256bb8796983ccc3b4b7cf30c /drivers/pci/endpoint
parentLinux 5.16-rc1 (diff)
downloadlinux-dev-50b620303a14e885529410d26800f92a735724d6.tar.xz
linux-dev-50b620303a14e885529410d26800f92a735724d6.zip
PCI: endpoint: Return -EINVAL when interrupts num is smaller than 1
In pci_epc_set_msi() we should return immediately if there are no interrupts to configure; update the code to return early. Link: https://lore.kernel.org/r/CH2PR19MB402491B9E503694DBCAC6005A07C9@CH2PR19MB4024.namprd19.prod.outlook.com Signed-off-by: Li Chen <lchen@ambarella.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/pci/endpoint')
-rw-r--r--drivers/pci/endpoint/pci-epc-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 38621558d397..3bc9273d0a08 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]))