Skip to contentSkip to conversation

iommu/amd: Handle return of iommu_device_sysfs_add

PATCH Applied Bo Liu 2 participants 2 messages Jul 1, 2022 – Jul 6, 2022

Subsystems (2)
lore
Share & tools
lore

Bo Liu

author
#0 lore raw

PATCH 1/1 iommu/amd: Handle return of iommu_device_sysfs_add

As iommu_device_sysfs_add() can fail, we should check the return value.

---
 drivers/iommu/amd/init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iommu/amd/init.c +4 -1
index 3c82d9c5f1c0..a3c4fdd40f04 100644
@@ -2058,8 +2058,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);
Signature · 1 line
2.27.0
maintainer Applied
#1 lore raw
Quoted 6 lines · Bo Liu

As iommu_device_sysfs_add() can fail, we should check the return value.

---
 drivers/iommu/amd/init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Applied, thanks.