Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1672477 > unrolled thread

[PATCH] iommu/intel-iommu: Handle return of iommu_device_register/iommu_device_sysfs_add

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-06-22 11:50 +0200
Last post2017-06-22 11:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] iommu/intel-iommu: Handle return of iommu_device_register/iommu_device_sysfs_add Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-06-22 11:50 +0200

#1672477 — [PATCH] iommu/intel-iommu: Handle return of iommu_device_register/iommu_device_sysfs_add

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-06-22 11:50 +0200
Subject[PATCH] iommu/intel-iommu: Handle return of iommu_device_register/iommu_device_sysfs_add
Message-ID<tV6Up-2Rl-15@gated-at.bofh.it>
iommu_device_register and iommu_device_sysfs_add can fail here and
we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/iommu/intel-iommu.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 9e35ad6..0e7b374 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4909,11 +4909,19 @@ int __init intel_iommu_init(void)
 	init_iommu_pm_ops();
 
 	for_each_active_iommu(iommu, drhd) {
-		iommu_device_sysfs_add(&iommu->iommu, NULL,
+		ret = iommu_device_sysfs_add(&iommu->iommu, NULL,
 				       intel_iommu_groups,
 				       "%s", iommu->name);
+		if (ret) {
+			pr_err("Failed to register iommu in sysfs\n");
+			goto out_free_reserved_range;
+		}
 		iommu_device_set_ops(&iommu->iommu, &intel_iommu_ops);
-		iommu_device_register(&iommu->iommu);
+		ret = iommu_device_register(&iommu->iommu);
+		if (ret) {
+			pr_err("Failed to register iommu\n");
+			goto out_free_reserved_range;
+		}
 	}
 
 	bus_set_iommu(&pci_bus_type, &intel_iommu_ops);
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web