[PATCH] perf/arm_pmu_platform: fix tests for platform_get_irq() failure

Yu Zhe posted 1 patch 3 years, 7 months ago
drivers/perf/arm_pmu_platform.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] perf/arm_pmu_platform: fix tests for platform_get_irq() failure
Posted by Yu Zhe 3 years, 7 months ago
The platform_get_irq() returns negative error codes.  It can't actually
return zero.

Signed-off-by: Yu Zhe <yuzhe@nfschina.com>
---
 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 513de1f54e2d..933b96e243b8 100644
--- a/drivers/perf/arm_pmu_platform.c
+++ b/drivers/perf/arm_pmu_platform.c
@@ -117,7 +117,7 @@ static int pmu_parse_irqs(struct arm_pmu *pmu)
 
 	if (num_irqs == 1) {
 		int irq = platform_get_irq(pdev, 0);
-		if (irq && irq_is_percpu_devid(irq))
+		if ((irq > 0) && irq_is_percpu_devid(irq))
 			return pmu_parse_percpu_irq(pmu, irq);
 	}
 
-- 
2.11.0
Re: [PATCH] perf/arm_pmu_platform: fix tests for platform_get_irq() failure
Posted by Will Deacon 3 years, 7 months ago
On Thu, 25 Aug 2022 09:18:44 +0800, Yu Zhe wrote:
> The platform_get_irq() returns negative error codes.  It can't actually
> return zero.
> 
> 

Applied to arm64 (for-next/fixes), thanks!

[1/1] perf/arm_pmu_platform: fix tests for platform_get_irq() failure
      https://git.kernel.org/arm64/c/6bb0d64c1000

Cheers,
-- 
Will

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