[openwrt/openwrt] kernel: fix busy wait loop in mediatek PPE code

LEDE Commits lede-commits at lists.infradead.org
Mon Feb 15 02:13:20 EST 2021


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/3da4acaa7bba185489b968a140ecf327169db0bd

commit 3da4acaa7bba185489b968a140ecf327169db0bd
Author: Ilya Lipnitskiy <ilya.lipnitskiy at gmail.com>
AuthorDate: Sun Feb 7 20:17:12 2021 -0800

    kernel: fix busy wait loop in mediatek PPE code
    
    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 <ilya.lipnitskiy at gmail.com>
---
 .../770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/generic/pending-5.4/770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch b/target/linux/generic/pending-5.4/770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch
index d679e30bea..2614502f5a 100644
--- a/target/linux/generic/pending-5.4/770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch
+++ b/target/linux/generic/pending-5.4/770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch
@@ -183,7 +183,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 +{
 +	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;
 +



More information about the lede-commits mailing list