qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 06/11] hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write()
Date: Tue, 17 Mar 2020 11:40:34 +0000	[thread overview]
Message-ID: <20200317114039.26914-7-peter.maydell@linaro.org> (raw)
In-Reply-To: <20200317114039.26914-1-peter.maydell@linaro.org>

From: Chen Qun <kuhn.chenqun@huawei.com>

The current code causes clang static code analyzer generate warning:
hw/net/imx_fec.c:858:9: warning: Value stored to 'value' is never read
        value = value & 0x0000000f;
        ^       ~~~~~~~~~~~~~~~~~~
hw/net/imx_fec.c:864:9: warning: Value stored to 'value' is never read
        value = value & 0x000000fd;
        ^       ~~~~~~~~~~~~~~~~~~

According to the definition of the function, the two “value” assignments
 should be written to registers.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Message-id: 20200313123242.13236-1-kuhn.chenqun@huawei.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/net/imx_fec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
index 6a124a154a8..5c145a8197e 100644
--- a/hw/net/imx_fec.c
+++ b/hw/net/imx_fec.c
@@ -855,13 +855,15 @@ static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value)
         break;
     case ENET_TGSR:
         /* implement clear timer flag */
-        value = value & 0x0000000f;
+        s->regs[index] &= ~(value & 0x0000000f); /* all bits W1C */
         break;
     case ENET_TCSR0:
     case ENET_TCSR1:
     case ENET_TCSR2:
     case ENET_TCSR3:
-        value = value & 0x000000fd;
+        s->regs[index] &= ~(value & 0x00000080); /* W1C bits */
+        s->regs[index] &= ~0x0000007d; /* writable fields */
+        s->regs[index] |= (value & 0x0000007d);
         break;
     case ENET_TCCR0:
     case ENET_TCCR1:
-- 
2.20.1



  parent reply	other threads:[~2020-03-17 11:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 11:40 [PULL 00/11] target-arm queue Peter Maydell
2020-03-17 11:40 ` [PULL 01/11] hw/usb: Add basic i.MX USB Phy support Peter Maydell
2020-03-17 11:40 ` [PULL 02/11] hw/arm/fsl-imx6ul: Fix USB interrupt numbers Peter Maydell
2020-03-17 11:40 ` [PULL 03/11] hw/arm/fsl-imx6ul: Instantiate unimplemented pwm and can devices Peter Maydell
2020-03-17 11:40 ` [PULL 04/11] hw/arm/fsl-imx6ul: Wire up USB controllers Peter Maydell
2020-03-17 11:40 ` [PULL 05/11] hw/arm/fsl-imx6: " Peter Maydell
2020-03-17 11:40 ` Peter Maydell [this message]
2020-03-17 11:40 ` [PULL 07/11] m25p80: Convert to support tracing Peter Maydell
2020-03-17 11:40 ` [PULL 08/11] m25p80: Improve command handling for Jedec commands Peter Maydell
2020-03-17 11:40 ` [PULL 09/11] m25p80: Improve command handling for unsupported commands Peter Maydell
2020-03-17 11:40 ` [PULL 10/11] aspeed/smc: Fix number of dummy cycles for FAST_READ_4 command Peter Maydell
2020-03-17 11:40 ` [PULL 11/11] hw/arm/pxa2xx: Do not wire up OHCI for PXA255 Peter Maydell
2020-03-17 16:21 ` [PULL 00/11] target-arm queue Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200317114039.26914-7-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).