[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/11] hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write()
From: |
Peter Maydell |
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 |
From: Chen Qun <address@hidden>
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 <address@hidden>
Signed-off-by: Chen Qun <address@hidden>
Message-id: address@hidden
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
---
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
- [PULL 00/11] target-arm queue, Peter Maydell, 2020/03/17
- [PULL 02/11] hw/arm/fsl-imx6ul: Fix USB interrupt numbers, Peter Maydell, 2020/03/17
- [PULL 01/11] hw/usb: Add basic i.MX USB Phy support, Peter Maydell, 2020/03/17
- [PULL 03/11] hw/arm/fsl-imx6ul: Instantiate unimplemented pwm and can devices, Peter Maydell, 2020/03/17
- [PULL 04/11] hw/arm/fsl-imx6ul: Wire up USB controllers, Peter Maydell, 2020/03/17
- [PULL 05/11] hw/arm/fsl-imx6: Wire up USB controllers, Peter Maydell, 2020/03/17
- [PULL 06/11] hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write(),
Peter Maydell <=
- [PULL 08/11] m25p80: Improve command handling for Jedec commands, Peter Maydell, 2020/03/17
- [PULL 07/11] m25p80: Convert to support tracing, Peter Maydell, 2020/03/17
- [PULL 09/11] m25p80: Improve command handling for unsupported commands, Peter Maydell, 2020/03/17
- [PULL 11/11] hw/arm/pxa2xx: Do not wire up OHCI for PXA255, Peter Maydell, 2020/03/17
- [PULL 10/11] aspeed/smc: Fix number of dummy cycles for FAST_READ_4 command, Peter Maydell, 2020/03/17
- Re: [PULL 00/11] target-arm queue, Peter Maydell, 2020/03/17