Skip to content

Commit 3ec8ebd

Browse files
ij-intelbp3tk0v
authored andcommitted
EDAC/amd64: Convert PCIBIOS_* return codes to errnos
gpu_get_node_map() uses pci_read_config_dword() that returns PCIBIOS_* codes. The return code is then returned all the way into the module init function amd64_edac_init() that returns it as is. The module init functions, however, should return normal errnos. Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal errno before returning it from gpu_get_node_map(). For consistency, convert also the other similar cases which return PCIBIOS_* codes even if they do not have any bugs at the moment. Fixes: 4251566 ("EDAC/amd64: Cache and use GPU node map") Signed-off-by: Ilpo Järvinen <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent c3f38fa commit 3ec8ebd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/edac/amd64_edac.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset,
8181
amd64_warn("%s: error reading F%dx%03x.\n",
8282
func, PCI_FUNC(pdev->devfn), offset);
8383

84-
return err;
84+
return pcibios_err_to_errno(err);
8585
}
8686

8787
int __amd64_write_pci_cfg_dword(struct pci_dev *pdev, int offset,
@@ -94,7 +94,7 @@ int __amd64_write_pci_cfg_dword(struct pci_dev *pdev, int offset,
9494
amd64_warn("%s: error writing to F%dx%03x.\n",
9595
func, PCI_FUNC(pdev->devfn), offset);
9696

97-
return err;
97+
return pcibios_err_to_errno(err);
9898
}
9999

100100
/*
@@ -1025,8 +1025,10 @@ static int gpu_get_node_map(struct amd64_pvt *pvt)
10251025
}
10261026

10271027
ret = pci_read_config_dword(pdev, REG_LOCAL_NODE_TYPE_MAP, &tmp);
1028-
if (ret)
1028+
if (ret) {
1029+
ret = pcibios_err_to_errno(ret);
10291030
goto out;
1031+
}
10301032

10311033
gpu_node_map.node_count = FIELD_GET(LNTM_NODE_COUNT, tmp);
10321034
gpu_node_map.base_node_id = FIELD_GET(LNTM_BASE_NODE_ID, tmp);

0 commit comments

Comments
 (0)