Skip to content

Commit 50b6203

Browse files
FirstLoveLifeLorenzo Pieralisi
authored andcommitted
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 <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Kishon Vijay Abraham I <[email protected]>
1 parent fa55b7d commit 50b6203

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pci/endpoint/pci-epc-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 vfunc_no, u8 interrupts)
334334
u8 encode_int;
335335

336336
if (IS_ERR_OR_NULL(epc) || func_no >= epc->max_functions ||
337-
interrupts > 32)
337+
interrupts < 1 || interrupts > 32)
338338
return -EINVAL;
339339

340340
if (vfunc_no > 0 && (!epc->max_vfs || vfunc_no > epc->max_vfs[func_no]))

0 commit comments

Comments
 (0)