aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Liu <[email protected]>2022-07-01 02:20:08 -0400
committerJoerg Roedel <[email protected]>2022-07-07 09:37:06 +0200
commit83874d51eb4a51725c9403e11476a433add98c34 (patch)
treee1c609528f3c354214f3414792e97a490c9e46fb
parent0d10fe7591178713695d7d8d77284b2fc2e6629f (diff)
iommu/amd: Handle return of iommu_device_sysfs_add
As iommu_device_sysfs_add() can fail, we should check the return value. Signed-off-by: Bo Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
-rw-r--r--drivers/iommu/amd/init.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 1d08f87e734b..298c836e174f 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -1906,8 +1906,11 @@ static int __init iommu_init_pci(struct amd_iommu *iommu)
amd_iommu_erratum_746_workaround(iommu);
amd_iommu_ats_write_check_workaround(iommu);
- iommu_device_sysfs_add(&iommu->iommu, &iommu->dev->dev,
+ ret = iommu_device_sysfs_add(&iommu->iommu, &iommu->dev->dev,
amd_iommu_groups, "ivhd%d", iommu->index);
+ if (ret)
+ return ret;
+
iommu_device_register(&iommu->iommu, &amd_iommu_ops, NULL);
return pci_enable_device(iommu->dev);