ACPI: VIOT: Do not dereference fwnode in struct device
Subsystems (2)
PATCH 1/1 ACPI: VIOT: 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() and device_match_fwnode() APIs for that.
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/acpi/viot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/viot.c +3 -3
@@ -88,7 +88,7 @@ static int __init viot_get_pci_iommu_fwnode(struct viot_iommu *viommu,return -ENODEV ; } - fwnode = pdev->dev.fwnode; + fwnode =dev_fwnode (&pdev->dev);if (!fwnode) {/* * PCI devices aren't necessarily described by ACPI. Create a
@@ -101,7 +101,7 @@ static int __init viot_get_pci_iommu_fwnode(struct viot_iommu *viommu, }set_primary_fwnode (&pdev->dev, fwnode); } - viommu->fwnode = pdev->dev.fwnode; + viommu->fwnode =dev_fwnode (&pdev->dev);pci_dev_put (pdev);return 0 ; }
@@ -314,7 +314,7 @@ static int viot_dev_iommu_init(struct device *dev, struct viot_iommu *viommu,return -ENODEV ;/* We're not translating ourself */ -if (viommu->fwnode == dev->fwnode) +if (device_match_fwnode (dev, viommu->fwnode))return -EINVAL ; ops =iommu_ops_from_fwnode (viommu->fwnode);
Signature · 1 line
2.35.1
Hi Andy,
Quoted 6 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()anddevice_match_fwnode()APIs for that.Signed-off-by Andy Shevchenko <[email protected]>
Reviewed-by Eric Auger <[email protected]>
Thanks
Eric
Quoted 35 lines
--- drivers/acpi/viot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/acpi/viot.c +3
-3@@ -88,7 +88,7 @@ static int __init viot_get_pci_iommu_fwnode(struct viot_iommu *viommu,return -ENODEV ; } - fwnode = pdev->dev.fwnode; + fwnode =dev_fwnode (&pdev->dev);if (!fwnode) {/* * PCI devices aren't necessarily described by ACPI. Create a @@ -101,7 +101,7 @@ static int __init viot_get_pci_iommu_fwnode(struct viot_iommu *viommu, }set_primary_fwnode (&pdev->dev, fwnode); } - viommu->fwnode = pdev->dev.fwnode; + viommu->fwnode =dev_fwnode (&pdev->dev);pci_dev_put (pdev);return 0 ; }@@ -314,7 +314,7 @@ static int viot_dev_iommu_init(struct device *dev, struct viot_iommu *viommu,return -ENODEV ;/* We're not translating ourself */ -if (viommu->fwnode == dev->fwnode) +if (device_match_fwnode (dev, viommu->fwnode))return -EINVAL ; ops =iommu_ops_from_fwnode (viommu->fwnode);
Quoted 11 lines · Eric Auger
Hi Andy,
Quoted 6 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()anddevice_match_fwnode()APIs for that.Signed-off-by Andy Shevchenko <[email protected]>Reviewed-by Eric Auger <[email protected]>
Applied, thanks!
Quoted 36 lines
Quoted 35 lines
--- drivers/acpi/viot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/acpi/viot.c +3
-3@@ -88,7 +88,7 @@ static int __init viot_get_pci_iommu_fwnode(struct viot_iommu *viommu,return -ENODEV ; } - fwnode = pdev->dev.fwnode; + fwnode =dev_fwnode (&pdev->dev);if (!fwnode) {/* * PCI devices aren't necessarily described by ACPI. Create a @@ -101,7 +101,7 @@ static int __init viot_get_pci_iommu_fwnode(struct viot_iommu *viommu, }set_primary_fwnode (&pdev->dev, fwnode); } - viommu->fwnode = pdev->dev.fwnode; + viommu->fwnode =dev_fwnode (&pdev->dev);pci_dev_put (pdev);return 0 ; }@@ -314,7 +314,7 @@ static int viot_dev_iommu_init(struct device *dev, struct viot_iommu *viommu,return -ENODEV ;/* We're not translating ourself */ -if (viommu->fwnode == dev->fwnode) +if (device_match_fwnode (dev, viommu->fwnode))return -EINVAL ; ops =iommu_ops_from_fwnode (viommu->fwnode);