Skip to content

Commit 06687a0

Browse files
ssuthiku-amdjoergroedel
authored andcommitted
iommu/amd: Improve error handling for amd_iommu_init_pci
Add error messages to prevent silent failure. Signed-off-by: Vasant Hegde <vasant.hegde@amd.com> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Link: https://lore.kernel.org/r/20220301085626.87680-2-vasant.hegde@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 754e0b0 commit 06687a0

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

drivers/iommu/amd/init.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,9 +1943,11 @@ static int __init amd_iommu_init_pci(void)
19431943

19441944
for_each_iommu(iommu) {
19451945
ret = iommu_init_pci(iommu);
1946-
if (ret)
1947-
break;
1948-
1946+
if (ret) {
1947+
pr_err("IOMMU%d: Failed to initialize IOMMU Hardware (error=%d)!\n",
1948+
iommu->index, ret);
1949+
goto out;
1950+
}
19491951
/* Need to setup range after PCI init */
19501952
iommu_set_cwwb_range(iommu);
19511953
}
@@ -1961,6 +1963,11 @@ static int __init amd_iommu_init_pci(void)
19611963
* active.
19621964
*/
19631965
ret = amd_iommu_init_api();
1966+
if (ret) {
1967+
pr_err("IOMMU: Failed to initialize IOMMU-API interface (error=%d)!\n",
1968+
ret);
1969+
goto out;
1970+
}
19641971

19651972
init_device_table_dma();
19661973

@@ -1970,6 +1977,7 @@ static int __init amd_iommu_init_pci(void)
19701977
if (!ret)
19711978
print_iommu_info();
19721979

1980+
out:
19731981
return ret;
19741982
}
19751983

0 commit comments

Comments
 (0)