Skip to contentSkip to conversation

perf: arm_pmu: Use of_property_present()

PATCH Applied Rob Herring (Arm) 4 participants 4 messages Jul 31, 2024 – Aug 16, 2024 Arm PMU profiling and debugging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: arm_pmu: Use of_property_present()

Use of_property_present() to test for property presence rather than of_find_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.

---
 drivers/perf/arm_pmu_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm_pmu_platform.c +1 -1
index 4b1a9a92ea11..118170a5cede 100644
@@ -59,7 +59,7 @@ static int pmu_parse_percpu_irq(struct arm_pmu *pmu, int irq)
 
 static bool pmu_has_irq_affinity(struct device_node *node)
 {
-	return !!of_find_property(node, "interrupt-affinity", NULL);
+	return of_property_present(node, "interrupt-affinity");
 }
 
 static int pmu_parse_irq_affinity(struct device *dev, int i)
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Rob Herring (Arm)

Use of_property_present() to test for property presence rather than of_find_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.

---
 drivers/perf/arm_pmu_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm_pmu_platform.c +0 -0
index 4b1a9a92ea11..118170a5cede 100644

drivers/perf/arm_pmu_platform.c static int pmu_parse_percpu_irq(struct arm_pmu *pmu, int irq) · line 65

Quoted 8 lines
drivers/perf/arm_pmu_platform.c +1 -1
@@ -59,7 +59,7 @@ static int pmu_parse_percpu_irq(struct arm_pmu *pmu, int irq)
 
 static bool pmu_has_irq_affinity(struct device_node *node)
 {
-	return !!of_find_property(node, "interrupt-affinity", NULL);
+	return of_property_present(node, "interrupt-affinity");
 }
 
 static int pmu_parse_irq_affinity(struct device *dev, int i)

After this change there are no of_find_property() instances left in the drivers/perf directory.

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Rob Herring (Arm)
Quoted 7 lines · Rob Herring (Arm)

Use of_property_present() to test for property presence rather than of_find_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.

I assume Will will pick this up.

Mark.

Quoted 20 lines
---
 drivers/perf/arm_pmu_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm_pmu_platform.c +1 -1
index 4b1a9a92ea11..118170a5cede 100644
@@ -59,7 +59,7 @@ static int pmu_parse_percpu_irq(struct arm_pmu *pmu, int irq)
 
 static bool pmu_has_irq_affinity(struct device_node *node)
 {
-	return !!of_find_property(node, "interrupt-affinity", NULL);
+	return of_property_present(node, "interrupt-affinity");
 }
 
 static int pmu_parse_irq_affinity(struct device *dev, int i)
Signature · 1 line
2.43.0
maintainer Applied
#3 lore raw
In reply to Rob Herring (Arm)
Quoted 8 lines · Rob Herring (Arm)

Use of_property_present() to test for property presence rather than of_find_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.

[...]

Applied to will (for-next/perf), thanks!

[1/1] perf: arm_pmu: Use of_property_present()

      https://git.kernel.org/will/c/48b035121a56

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev