Skip to content

Commit 04f4f33

Browse files
robherringjoergroedel
authored andcommitted
iommu: Use of_property_present()
Use of_property_present() to test for property presence rather than of_(find|get)_property(). This is part of a larger effort to remove callers of of_find_property() and similar functions. of_find_property() leaks the DT struct property and data pointers which is a problem for dynamically allocated nodes which may be freed. Signed-off-by: Rob Herring (Arm) <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 84b2baf commit 04f4f33

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

drivers/iommu/fsl_pamu_domain.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,14 +416,12 @@ static struct iommu_group *fsl_pamu_device_group(struct device *dev)
416416

417417
static struct iommu_device *fsl_pamu_probe_device(struct device *dev)
418418
{
419-
int len;
420-
421419
/*
422420
* uboot must fill the fsl,liodn for platform devices to be supported by
423421
* the iommu.
424422
*/
425423
if (!dev_is_pci(dev) &&
426-
!of_get_property(dev->of_node, "fsl,liodn", &len))
424+
!of_property_present(dev->of_node, "fsl,liodn"))
427425
return ERR_PTR(-ENODEV);
428426

429427
return &pamu_iommu;

drivers/iommu/of_iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void of_iommu_get_resv_regions(struct device *dev, struct list_head *list)
214214
* that represent reservations in the IOVA space, which are regions that should
215215
* not be mapped.
216216
*/
217-
if (of_find_property(it.node, "reg", NULL)) {
217+
if (of_property_present(it.node, "reg")) {
218218
err = of_address_to_resource(it.node, 0, &phys);
219219
if (err < 0) {
220220
dev_err(dev, "failed to parse memory region %pOF: %d\n",

0 commit comments

Comments
 (0)