Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH next] perf: arm-ni: Fix an NULL vs IS_ERR() bug
@ 2024-09-11  7:39 Dan Carpenter
  2024-09-11 12:13 ` Robin Murphy
  2024-09-12 12:57 ` Will Deacon
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-09-11  7:39 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Will Deacon, Mark Rutland, linux-arm-kernel, linux-kernel,
	kernel-janitors

The devm_ioremap() function never returns error pointers, it returns a
NULL pointer if there is an error.

Fixes: 4d5a7680f2b4 ("perf: Add driver for Arm NI-700 interconnect PMU")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/perf/arm-ni.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/perf/arm-ni.c b/drivers/perf/arm-ni.c
index b72df3aea93e..90fcfe693439 100644
--- a/drivers/perf/arm-ni.c
+++ b/drivers/perf/arm-ni.c
@@ -603,8 +603,8 @@ static int arm_ni_probe(struct platform_device *pdev)
 	 */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
-	if (IS_ERR(base))
-		return PTR_ERR(base);
+	if (!base)
+		return -ENOMEM;
 
 	arm_ni_probe_domain(base, &cfg);
 	if (cfg.type != NI_GLOBAL)
-- 
2.45.2



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

* Re: [PATCH next] perf: arm-ni: Fix an NULL vs IS_ERR() bug
  2024-09-11  7:39 [PATCH next] perf: arm-ni: Fix an NULL vs IS_ERR() bug Dan Carpenter
@ 2024-09-11 12:13 ` Robin Murphy
  2024-09-12 12:57 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Robin Murphy @ 2024-09-11 12:13 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Will Deacon, Mark Rutland, linux-arm-kernel, linux-kernel,
	kernel-janitors

On 2024-09-11 8:39 am, Dan Carpenter wrote:
> The devm_ioremap() function never returns error pointers, it returns a
> NULL pointer if there is an error.

Ah, this code went through a few evolutions, and apparently I missed 
that devm_ioremap() and devm_ioremap_resource() helpfully have different 
behaviour, urgh. Thanks Dan!

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> Fixes: 4d5a7680f2b4 ("perf: Add driver for Arm NI-700 interconnect PMU")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>   drivers/perf/arm-ni.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/perf/arm-ni.c b/drivers/perf/arm-ni.c
> index b72df3aea93e..90fcfe693439 100644
> --- a/drivers/perf/arm-ni.c
> +++ b/drivers/perf/arm-ni.c
> @@ -603,8 +603,8 @@ static int arm_ni_probe(struct platform_device *pdev)
>   	 */
>   	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>   	base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> -	if (IS_ERR(base))
> -		return PTR_ERR(base);
> +	if (!base)
> +		return -ENOMEM;
>   
>   	arm_ni_probe_domain(base, &cfg);
>   	if (cfg.type != NI_GLOBAL)


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

* Re: [PATCH next] perf: arm-ni: Fix an NULL vs IS_ERR() bug
  2024-09-11  7:39 [PATCH next] perf: arm-ni: Fix an NULL vs IS_ERR() bug Dan Carpenter
  2024-09-11 12:13 ` Robin Murphy
@ 2024-09-12 12:57 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2024-09-12 12:57 UTC (permalink / raw)
  To: Robin Murphy, Dan Carpenter
  Cc: catalin.marinas, kernel-team, Will Deacon, Mark Rutland,
	linux-arm-kernel, linux-kernel, kernel-janitors

On Wed, 11 Sep 2024 10:39:59 +0300, Dan Carpenter wrote:
> The devm_ioremap() function never returns error pointers, it returns a
> NULL pointer if there is an error.
> 
> 

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

[1/1] perf: arm-ni: Fix an NULL vs IS_ERR() bug
      https://git.kernel.org/will/c/2e091a805feb

Cheers,
-- 
Will

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


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

end of thread, other threads:[~2024-09-12 12:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-11  7:39 [PATCH next] perf: arm-ni: Fix an NULL vs IS_ERR() bug Dan Carpenter
2024-09-11 12:13 ` Robin Murphy
2024-09-12 12:57 ` Will Deacon

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