Skip to content

Commit ad98391

Browse files
committed
PCI/AER: Simplify pci_print_aer()
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 <[email protected]> Tested-by: Krzysztof Wilczyński <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 57964ba commit ad98391

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/pci/pcie/aer.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,10 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
766766
{
767767
int layer, agent, tlp_header_valid = 0;
768768
u32 status, mask;
769-
struct aer_err_info info;
769+
struct aer_err_info info = {
770+
.severity = aer_severity,
771+
.first_error = PCI_ERR_CAP_FEP(aer->cap_control),
772+
};
770773

771774
if (aer_severity == AER_CORRECTABLE) {
772775
status = aer->cor_status;
@@ -777,14 +780,11 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
777780
tlp_header_valid = status & AER_LOG_TLP_MASKS;
778781
}
779782

780-
layer = AER_GET_LAYER_ERROR(aer_severity, status);
781-
agent = AER_GET_AGENT(aer_severity, status);
782-
783-
memset(&info, 0, sizeof(info));
784-
info.severity = aer_severity;
785783
info.status = status;
786784
info.mask = mask;
787-
info.first_error = PCI_ERR_CAP_FEP(aer->cap_control);
785+
786+
layer = AER_GET_LAYER_ERROR(aer_severity, status);
787+
agent = AER_GET_AGENT(aer_severity, status);
788788

789789
pci_err(dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n", status, mask);
790790
__aer_print_error(dev, &info);
@@ -798,7 +798,7 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
798798
if (tlp_header_valid)
799799
pcie_print_tlp_log(dev, &aer->header_log, dev_fmt(" "));
800800

801-
trace_aer_event(dev_name(&dev->dev), (status & ~mask),
801+
trace_aer_event(pci_name(dev), (status & ~mask),
802802
aer_severity, tlp_header_valid, &aer->header_log);
803803
}
804804
EXPORT_SYMBOL_NS_GPL(pci_print_aer, "CXL");

0 commit comments

Comments
 (0)