[PATCH 15/15] powerpc: law: use signed type to allow error checking

Sascha Hauer s.hauer at pengutronix.de
Mon May 17 11:54:24 PDT 2021


unsigned idx is checked for >= 0 which is always true and < 0 which is
never true. Use a signed type instead.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/powerpc/mach-mpc85xx/fsl_law.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/mach-mpc85xx/fsl_law.c b/arch/powerpc/mach-mpc85xx/fsl_law.c
index 2254c92544..e3c765f30f 100644
--- a/arch/powerpc/mach-mpc85xx/fsl_law.c
+++ b/arch/powerpc/mach-mpc85xx/fsl_law.c
@@ -81,7 +81,7 @@ static void fsl_set_next_law(phys_addr_t addr, enum law_size sz,
 static void fsl_set_last_law(phys_addr_t addr, enum law_size sz,
 			enum law_trgt_if id)
 {
-	u32 idx;
+	int idx;
 
 	for (idx = (FSL_HW_NUM_LAWS - 1); idx >= 0; idx--) {
 		if (fsl_is_free_law(idx)) {
-- 
2.29.2




More information about the barebox mailing list