Skip to content

Commit

Permalink
kernel: fix busy wait loop in mediatek PPE code
Browse files Browse the repository at this point in the history
The intention is for the loop to timeout if the body does not succeed.
The current logic calls time_is_before_jiffies(timeout) which is false
until after the timeout, so the loop body never executes.

time_is_after_jiffies(timeout) will return true until timeout is less
than jiffies, which is the intended behavior here.

Signed-off-by: Ilya Lipnitskiy <[email protected]>
  • Loading branch information
lipnitsk authored and nbd168 committed Feb 15, 2021
1 parent f378d81 commit 3da4aca
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Signed-off-by: Felix Fietkau <[email protected]>
+{
+ unsigned long timeout = jiffies + HZ;
+
+ while (time_is_before_jiffies(timeout)) {
+ while (time_is_after_jiffies(timeout)) {
+ if (!(ppe_r32(ppe, MTK_PPE_GLO_CFG) & MTK_PPE_GLO_CFG_BUSY))
+ return 0;
+
Expand Down

0 comments on commit 3da4aca

Please sign in to comment.