Skip to contentSkip to conversation

iommu: Do not dereference fwnode in struct device

PATCH Applied Andy Shevchenko 3 participants 4 messages Aug 1, 2022 – Sep 7, 2022 IOMMU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu: Do not dereference fwnode in struct device

In order to make the underneath API easier to change in the future, prevent users from dereferencing fwnode from struct device. Instead, use the specific dev_fwnode() API for that.

---
 drivers/iommu/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu.c +1 -1
index 780fb7071577..31b5f4ceb2e9 100644
@@ -173,7 +173,7 @@ int iommu_device_register(struct iommu_device *iommu,
 
 	iommu->ops = ops;
 	if (hwdev)
-		iommu->fwnode = hwdev->fwnode;
+		iommu->fwnode = dev_fwnode(hwdev);
 
 	spin_lock(&iommu_device_lock);
 	list_add_tail(&iommu->list, &iommu_device_list);
Signature · 1 line
2.35.1
#1 lore raw
Quoted 3 lines · Andy Shevchenko

In order to make the underneath API easier to change in the future, prevent users from dereferencing fwnode from struct device. Instead, use the specific dev_fwnode() API for that.

Any news?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Andy Shevchenko
Quoted 3 lines · Andy Shevchenko

In order to make the underneath API easier to change in the future, prevent users from dereferencing fwnode from struct device. Instead, use the specific dev_fwnode() API for that.

Seems fair,

Quoted 18 lines
---
  drivers/iommu/iommu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu.c +1 -1
index 780fb7071577..31b5f4ceb2e9 100644
@@ -173,7 +173,7 @@ int iommu_device_register(struct iommu_device *iommu,
 
  	iommu->ops = ops;
  	if (hwdev)
-		iommu->fwnode = hwdev->fwnode;
+		iommu->fwnode = dev_fwnode(hwdev);
 
  	spin_lock(&iommu_device_lock);
  	list_add_tail(&iommu->list, &iommu_device_list);