Skip to content

Commit d72bae4

Browse files
committed
PCI/AER: Simplify add_error_device()
Return -ENOSPC error early so the usual path through add_error_device() is the straightline code. Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 94bc15c commit d72bae4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/pci/pcie/aer.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -816,12 +816,15 @@ EXPORT_SYMBOL_NS_GPL(pci_print_aer, "CXL");
816816
*/
817817
static int add_error_device(struct aer_err_info *e_info, struct pci_dev *dev)
818818
{
819-
if (e_info->error_dev_num < AER_MAX_MULTI_ERR_DEVICES) {
820-
e_info->dev[e_info->error_dev_num] = pci_dev_get(dev);
821-
e_info->error_dev_num++;
822-
return 0;
823-
}
824-
return -ENOSPC;
819+
int i = e_info->error_dev_num;
820+
821+
if (i >= AER_MAX_MULTI_ERR_DEVICES)
822+
return -ENOSPC;
823+
824+
e_info->dev[i] = pci_dev_get(dev);
825+
e_info->error_dev_num++;
826+
827+
return 0;
825828
}
826829

827830
/**

0 commit comments

Comments
 (0)