Skip to contentSkip to conversation

ARM: cache: Fix incorrect bitwise operation

PATCH In review Marek Vasut 4 participants 4 messages Feb 19, 2019 – Feb 28, 2019 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: cache: Fix incorrect bitwise operation

The loop implemented in the code is supposed to check whether the PL310 operation register has any bit from the mask set. Currently, the code checks whether the PL310 operation register has any bit set AND whether the mask is non-zero, which is incorrect. Fix the conditional.

Cc Dalon Westergreen <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Tom Rini <[email protected]>
Fixes 93bc21930a1b ("armv7: add PL310 support to u-boot")
---
 arch/arm/lib/cache-pl310.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/cache-pl310.c +1 -1
index 1296ba6efd..bbaaaa4157 100644
@@ -33,7 +33,7 @@ static void pl310_background_op_all_ways(u32 *op_reg)
 	/* Invalidate all ways */
 	writel(way_mask, op_reg);
 	/* Wait for all ways to be invalidated */
-	while (readl(op_reg) && way_mask)
+	while (readl(op_reg) & way_mask)
 		;
 	pl310_cache_sync();
 }
Signature · 1 line
2.19.2
#1 lore raw

PATCH 1/1 ARM: cache: Fix incorrect bitwise operation

Quoted 7 lines · Marek Vasut

The loop implemented in the code is supposed to check whether the PL310 operation register has any bit from the mask set. Currently, the code checks whether the PL310 operation register has any bit set AND whether the mask is non-zero, which is incorrect. Fix the conditional.

Quoted 5 lines
Cc Dalon Westergreen <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Tom Rini <[email protected]>
Fixes 93bc21930a1b ("armv7: add PL310 support to u-boot")
Quoted 19 lines
---
 arch/arm/lib/cache-pl310.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/cache-pl310.c +1 -2
index 1296ba6efd..bbaaaa4157 100644
@@ -33,7 +33,7 @@ static void pl310_background_op_all_ways(u32 *op_reg)
        /* Invalidate all ways */
        writel(way_mask, op_reg);
        /* Wait for all ways to be invalidated */
-       while (readl(op_reg) && way_mask)
+       while (readl(op_reg) & way_mask)
                ;
        pl310_cache_sync();
 }
--

2.19.2

#2 lore raw

PATCH 1/1 ARM: cache: Fix incorrect bitwise operation

In reply to Marek Vasut
Quoted 21 lines · Marek Vasut

The loop implemented in the code is supposed to check whether the PL310 operation register has any bit from the mask set. Currently, the code checks whether the PL310 operation register has any bit set AND whether the mask is non-zero, which is incorrect. Fix the conditional.

Cc Dalon Westergreen <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Tom Rini <[email protected]>
Fixes 93bc21930a1b ("armv7: add PL310 support to u-boot")
---
 arch/arm/lib/cache-pl310.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/lib/cache-pl310.c +0 -0
index 1296ba6efd..bbaaaa4157 100644

arch/arm/lib/cache-pl310.c static void pl310_background_op_all_ways(u32 *op_reg) · line 39

Quoted 8 lines
arch/arm/lib/cache-pl310.c +1 -1
@@ -33,7 +33,7 @@ static void pl310_background_op_all_ways(u32 *op_reg)
 	/* Invalidate all ways */
 	writel(way_mask, op_reg);
 	/* Wait for all ways to be invalidated */
-	while (readl(op_reg) && way_mask)
+	while (readl(op_reg) & way_mask)
 		;
 	pl310_cache_sync();
 }

Thanks for fixing this!

Dinh

#3 lore raw
In reply to Marek Vasut
Quoted 6 lines · Marek Vasut

The loop implemented in the code is supposed to check whether the PL310 operation register has any bit from the mask set. Currently, the code checks whether the PL310 operation register has any bit set AND whether the mask is non-zero, which is incorrect. Fix the conditional.

Quoted 7 lines
Cc Dalon Westergreen <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Tom Rini <[email protected]>
Fixes 93bc21930a1b ("armv7: add PL310 support to u-boot")

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190228/4725b923/attachment.sig>