Commit 6ba5dcdc authored by Borislav Petkov's avatar Borislav Petkov

amd64_edac: wrap-up pci config read error handling

Add a pci config read wrapper for signaling pci config space access
errors instead of them being visible only on a debug build. This is
important on amd64_edac since it uses all those pci config register
values to access the DRAM/DIMM configuration of the nodes.

In addition, the wrapper makes a _lot_ (look at the diffstat!) of
error handling code superfluous and improves much of the overall code
readability by removing error handling details out of the way.
Signed-off-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
parent f6d6ae96
This diff is collapsed.
...@@ -565,6 +565,22 @@ static inline struct low_ops *family_ops(int index) ...@@ -565,6 +565,22 @@ static inline struct low_ops *family_ops(int index)
return &amd64_family_types[index].ops; return &amd64_family_types[index].ops;
} }
static inline int amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset,
u32 *val, const char *func)
{
int err = 0;
err = pci_read_config_dword(pdev, offset, val);
if (err)
amd64_printk(KERN_WARNING, "%s: error reading F%dx%x.\n",
func, PCI_FUNC(pdev->devfn), offset);
return err;
}
#define amd64_read_pci_cfg(pdev, offset, val) \
amd64_read_pci_cfg_dword(pdev, offset, val, __func__)
/* /*
* For future CPU versions, verify the following as new 'slow' rates appear and * For future CPU versions, verify the following as new 'slow' rates appear and
* modify the necessary skip values for the supported CPU. * modify the necessary skip values for the supported CPU.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment