Re: [PATCH v8 17/20] PCI/AER: Simplify add_error_device()

Sathyanarayanan Kuppuswamy
2025-05-22T23:57:24Z

On 5/22/25 4:21 PM, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Return -ENOSPC error early so the usual path through add_error_device() is
> the straightline code.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

> drivers/pci/pcie/aer.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 237741e66d28..24f0f5c55256 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -816,12 +816,15 @@ EXPORT_SYMBOL_NS_GPL(pci_print_aer, "CXL");
> */
> static int add_error_device(struct aer_err_info *e_info, struct pci_dev *dev)
> {
> - if (e_info->error_dev_num < AER_MAX_MULTI_ERR_DEVICES) {
> - e_info->dev[e_info->error_dev_num] = pci_dev_get(dev);
> - e_info->error_dev_num++;
> - return 0;
> - }
> - return -ENOSPC;
> + int i = e_info->error_dev_num;
> +
> + if (i >= AER_MAX_MULTI_ERR_DEVICES)
> + return -ENOSPC;
> +
> + e_info->dev[i] = pci_dev_get(dev);
> + e_info->error_dev_num++;
> +
> + return 0;
> }
>
> /**

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer