public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: arm_pmu: Use of_property_present()
@ 2024-07-31 19:12 Rob Herring (Arm)
  2024-08-01 11:11 ` Anshuman Khandual
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rob Herring (Arm) @ 2024-07-31 19:12 UTC (permalink / raw)
  To: Will Deacon, Mark Rutland; +Cc: linux-arm-kernel, linux-kernel

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.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 drivers/perf/arm_pmu_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c
index 4b1a9a92ea11..118170a5cede 100644
--- a/drivers/perf/arm_pmu_platform.c
+++ b/drivers/perf/arm_pmu_platform.c
@@ -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)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf: arm_pmu: Use of_property_present()
  2024-07-31 19:12 [PATCH] perf: arm_pmu: Use of_property_present() Rob Herring (Arm)
@ 2024-08-01 11:11 ` Anshuman Khandual
  2024-08-03 11:02 ` Mark Rutland
  2024-08-16 15:15 ` Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2024-08-01 11:11 UTC (permalink / raw)
  To: Rob Herring (Arm), Will Deacon, Mark Rutland
  Cc: linux-arm-kernel, linux-kernel

On 8/1/24 00:42, Rob Herring (Arm) wrote:
> 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.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---
>  drivers/perf/arm_pmu_platform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c
> index 4b1a9a92ea11..118170a5cede 100644
> --- a/drivers/perf/arm_pmu_platform.c
> +++ b/drivers/perf/arm_pmu_platform.c
> @@ -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.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf: arm_pmu: Use of_property_present()
  2024-07-31 19:12 [PATCH] perf: arm_pmu: Use of_property_present() Rob Herring (Arm)
  2024-08-01 11:11 ` Anshuman Khandual
@ 2024-08-03 11:02 ` Mark Rutland
  2024-08-16 15:15 ` Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Rutland @ 2024-08-03 11:02 UTC (permalink / raw)
  To: Rob Herring (Arm); +Cc: Will Deacon, linux-arm-kernel, linux-kernel

On Wed, Jul 31, 2024 at 01:12:53PM -0600, Rob Herring (Arm) wrote:
> 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.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

Acked-by: Mark Rutland <mark.rutland@arm.com>

I assume Will will pick this up.

Mark.

> ---
>  drivers/perf/arm_pmu_platform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c
> index 4b1a9a92ea11..118170a5cede 100644
> --- a/drivers/perf/arm_pmu_platform.c
> +++ b/drivers/perf/arm_pmu_platform.c
> @@ -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)
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf: arm_pmu: Use of_property_present()
  2024-07-31 19:12 [PATCH] perf: arm_pmu: Use of_property_present() Rob Herring (Arm)
  2024-08-01 11:11 ` Anshuman Khandual
  2024-08-03 11:02 ` Mark Rutland
@ 2024-08-16 15:15 ` Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2024-08-16 15:15 UTC (permalink / raw)
  To: Mark Rutland, Rob Herring (Arm)
  Cc: catalin.marinas, kernel-team, Will Deacon, linux-arm-kernel,
	linux-kernel

On Wed, 31 Jul 2024 13:12:53 -0600, Rob Herring (Arm) wrote:
> 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,
-- 
Will

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-16 15:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31 19:12 [PATCH] perf: arm_pmu: Use of_property_present() Rob Herring (Arm)
2024-08-01 11:11 ` Anshuman Khandual
2024-08-03 11:02 ` Mark Rutland
2024-08-16 15:15 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox