qemu-riscv.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] hw/dma: sifive_pdma: Improve code readability for "!!foo & bar"
@ 2021-09-27  2:21 Bin Meng
  2021-09-27  2:21 ` [PATCH 2/2] hw/dma: sifive_pdma: Don't run DMA when channel is disclaimed Bin Meng
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Bin Meng @ 2021-09-27  2:21 UTC (permalink / raw)
  To: Alistair Francis, qemu-devel, qemu-riscv; +Cc: Frank Chang

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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-09-27  7:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-27  2:21 [PATCH 1/2] hw/dma: sifive_pdma: Improve code readability for "!!foo & bar" Bin Meng
2021-09-27  2:21 ` [PATCH 2/2] hw/dma: sifive_pdma: Don't run DMA when channel is disclaimed Bin Meng
2021-09-27  4:47 ` [PATCH 1/2] hw/dma: sifive_pdma: Improve code readability for "!!foo & bar" Philippe Mathieu-Daudé
2021-09-27  5:18   ` Philippe Mathieu-Daudé
2021-09-27  6:51   ` Bin Meng
2021-09-27  6:51 ` Markus Armbruster
2021-09-27  6:59   ` Bin Meng
2021-09-27  7:16     ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).