From 3f738f5897a6694b8630d3a9c6751f49c3c7d540 Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Fri, 9 Aug 2019 17:13:57 -0600 Subject: [PATCH] lib: Use bitwise & instead of boolean && !(mipval && MIP_MSIP) simplifies to !mipval, which checks if the entire variable is zero, not just a single bit. Fix this to use bitwise & instead. Signed-off-by: Jacob Garber Reviewed-by: Bin Meng Reviewed-by: Atish Patra --- lib/sbi/sbi_hart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 3be5b8a4..6bf0e136 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -339,7 +339,7 @@ void sbi_hart_wait_for_coldboot(struct sbi_scratch *scratch, u32 hartid) spin_lock(&coldboot_wait_bitmap_lock); coldboot_wait_bitmap &= ~(1UL << hartid); spin_unlock(&coldboot_wait_bitmap_lock); - } while (!(mipval && MIP_MSIP)); + } while (!(mipval & MIP_MSIP)); csr_clear(CSR_MIP, MIP_MSIP); }