[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] hw/dma: sifive_pdma: Improve code readability for "!!foo & b
From: |
Bin Meng |
Subject: |
[PATCH 1/2] hw/dma: sifive_pdma: Improve code readability for "!!foo & bar" |
Date: |
Mon, 27 Sep 2021 10:21:12 +0800 |
GCC seems to be strict about processing pattern like "!!for & bar".
When 'bar' is not 0 or 1, it complains with -Werror=parentheses:
suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’
[-Werror=parentheses]
Add a () around "foo && bar", which also improves code readability.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
hw/dma/sifive_pdma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/dma/sifive_pdma.c b/hw/dma/sifive_pdma.c
index b4fd40573a..b8ec7621f3 100644
--- a/hw/dma/sifive_pdma.c
+++ b/hw/dma/sifive_pdma.c
@@ -243,7 +243,7 @@ static void sifive_pdma_write(void *opaque, hwaddr offset,
offset &= 0xfff;
switch (offset) {
case DMA_CONTROL:
- claimed = !!s->chan[ch].control & CONTROL_CLAIM;
+ claimed = !!(s->chan[ch].control & CONTROL_CLAIM);
if (!claimed && (value & CONTROL_CLAIM)) {
/* reset Next* registers */
--
2.25.1
- [PATCH 1/2] hw/dma: sifive_pdma: Improve code readability for "!!foo & bar",
Bin Meng <=