Skip to contentSkip to conversation

iommu/virtio: Do not dereference fwnode in struct device

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

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/virtio: 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 device_match_fwnode() API for that.

---
 drivers/iommu/virtio-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/virtio-iommu.c +1 -1
index 08eeafc9529f..9fe723f55213 100644
@@ -925,7 +925,7 @@ static struct virtio_driver virtio_iommu_drv;
 
 static int viommu_match_node(struct device *dev, const void *data)
 {
-	return dev->parent->fwnode == data;
+	return device_match_fwnode(dev->parent, data);
 }
 
 static struct viommu_dev *viommu_get_by_fwnode(struct fwnode_handle *fwnode)
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 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 device_match_fwnode() API for that.

Quoted 20 lines
---
 drivers/iommu/virtio-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/virtio-iommu.c +1 -1
index 08eeafc9529f..9fe723f55213 100644
@@ -925,7 +925,7 @@ static struct virtio_driver virtio_iommu_drv;
 
 static int viommu_match_node(struct device *dev, const void *data)
 {
-	return dev->parent->fwnode == data;
+	return device_match_fwnode(dev->parent, data);
 }
 
 static struct viommu_dev *viommu_get_by_fwnode(struct fwnode_handle *fwnode)
Signature · 1 line
2.35.1
#2 lore raw
Quoted 6 lines · Jean-Philippe Brucker
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 device_match_fwnode() API for that.

Thanks!

Can it be applied now?

Signature · 2 lines
With Best Regards,
Andy Shevchenko