qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write()
@ 2020-02-25  2:59 Chen Qun
  2020-02-25  5:41 ` Jason Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Chen Qun @ 2020-02-25  2:59 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: peter.maydell, zhang.zhanghailiang, jasowang, qemu-arm,
	peter.chubb, Chen Qun

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>
---
I'm not sure if this modification is correct, just from the function
 definition, it is correct.
---
 hw/net/imx_fec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
index 6a124a154a..92f6215712 100644
--- a/hw/net/imx_fec.c
+++ b/hw/net/imx_fec.c
@@ -855,13 +855,13 @@ 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;
         break;
     case ENET_TCSR0:
     case ENET_TCSR1:
     case ENET_TCSR2:
     case ENET_TCSR3:
-        value = value & 0x000000fd;
+        s->regs[index] = value & 0x000000fd;
         break;
     case ENET_TCCR0:
     case ENET_TCCR1:
-- 
2.23.0




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

end of thread, other threads:[~2020-02-26  6:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-25  2:59 [PATCH] hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write() Chen Qun
2020-02-25  5:41 ` Jason Wang
2020-02-25 10:18   ` Peter Maydell
2020-02-26  3:03     ` Jason Wang
2020-02-26  6:35       ` Chenqun (kuhn)

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).