Skip to contentSkip to conversation

irqchip/gicv3: fix a loop timeout

PATCH In review Dan Carpenter 3 participants 3 messages Oct 14, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irqchip/gicv3: fix a loop timeout

We expect the loop to exit with "count" set to zero so let's switch it from a post-op to a pre-op count down. Otherwise we don't see the error message when this times out.

Fixes a2c225101234 ("irqchip: gic-v3: Refactor gic_enable_redist to support both enabling and disabling")
drivers/irqchip/irq-gic-v3.c +1 -1
index 9b81bd8..19d642e 100644
@@ -153,7 +153,7 @@ static void gic_enable_redist(bool enable)
 			return;	/* No PM support in this redistributor */
 	}
 
-	while (count--) {
+	while (--count) {
 		val = readl_relaxed(rbase + GICR_WAKER);
 		if (enable ^ (bool)(val & GICR_WAKER_ChildrenAsleep))
 			break;
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Dan Carpenter

We expect the loop to exit with "count" set to zero so let's switch it from a post-op to a pre-op count down. Otherwise we don't see the error message when this times out.

Nice catch.

Signature · 2 lines
Regards,
Sudeep
#2 lore raw

[tip:irq/urgent] irqchip/gicv3: Handle loop timeout proper

In reply to Dan Carpenter
irqchip/gicv3: Handle loop timeout proper
Commit-ID:  d102eb5c1ac5e6743b1c6d145c06a25d98ad1375
Gitweb:     http://git.kernel.org/tip/d102eb5c1ac5e6743b1c6d145c06a25d98ad1375
Author:     Dan Carpenter <[email protected]>
AuthorDate: Fri, 14 Oct 2016 10:26:21 +0300
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Fri, 14 Oct 2016 14:26:55 +0200

irqchip/gicv3: Handle loop timeout proper

The timeout loop terminates when the loop count is zero, but the decrement of the count variable is post check. So count is -1 when we check for the timeout and therefor the error message is supressed.

Change it to predecrement, so the error message is emitted.

[ tglx: Massaged changelog ]

Fixes a2c225101234 ("irqchip: gic-v3: Refactor gic_enable_redist to support both enabling and disabling")
Cc Marc Zyngier <[email protected]>
Cc Jason Cooper <[email protected]>
---
 drivers/irqchip/irq-gic-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3.c +1 -1
index 9b81bd8..19d642e 100644
@@ -153,7 +153,7 @@ static void gic_enable_redist(bool enable)
 			return;	/* No PM support in this redistributor */
 	}
 
-	while (count--) {
+	while (--count) {
 		val = readl_relaxed(rbase + GICR_WAKER);
 		if (enable ^ (bool)(val & GICR_WAKER_ChildrenAsleep))
 			break;