On 5/20/25 2:50 PM, Bjorn Helgaas wrote:
From: Bjorn Helgaas <bhelg...@google.com>

Simplify pci_print_aer() by initializing the struct aer_err_info "info"
with a designated initializer list (it was previously initialized with
memset()) and using pci_name().

Signed-off-by: Bjorn Helgaas <bhelg...@google.com>
Tested-by: Krzysztof Wilczyński <kwilczyn...@kernel.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvi...@linux.intel.com>
---

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

  drivers/pci/pcie/aer.c | 16 ++++++++--------
  1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index e6693f910a23..d845079429f0 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -765,7 +765,10 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
  {
        int layer, agent, tlp_header_valid = 0;
        u32 status, mask;
-       struct aer_err_info info;
+       struct aer_err_info info = {
+               .severity = aer_severity,
+               .first_error = PCI_ERR_CAP_FEP(aer->cap_control),
+       };
if (aer_severity == AER_CORRECTABLE) {
                status = aer->cor_status;
@@ -776,14 +779,11 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
                tlp_header_valid = status & AER_LOG_TLP_MASKS;
        }
- layer = AER_GET_LAYER_ERROR(aer_severity, status);
-       agent = AER_GET_AGENT(aer_severity, status);
-
-       memset(&info, 0, sizeof(info));
-       info.severity = aer_severity;
        info.status = status;
        info.mask = mask;
-       info.first_error = PCI_ERR_CAP_FEP(aer->cap_control);
+
+       layer = AER_GET_LAYER_ERROR(aer_severity, status);
+       agent = AER_GET_AGENT(aer_severity, status);
pci_err(dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n", status, mask);
        __aer_print_error(dev, &info);
@@ -797,7 +797,7 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
        if (tlp_header_valid)
                pcie_print_tlp_log(dev, &aer->header_log, dev_fmt("  "));
- trace_aer_event(dev_name(&dev->dev), (status & ~mask),
+       trace_aer_event(pci_name(dev), (status & ~mask),
                        aer_severity, tlp_header_valid, &aer->header_log);
  }
  EXPORT_SYMBOL_NS_GPL(pci_print_aer, "CXL");

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


Reply via email to