hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write()
PATCH 1/1 hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write()
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.
---
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(-)
hw/net/imx_fec.c +2 -2
@@ -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 :
Signature · 1 line
2.23.0
Jason Wang
AppliedQuoted 30 lines · 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 readvalue = 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 <[email protected]>Signed-off-by Chen Qun <[email protected]>---
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(-)hw/net/imx_fec.c +1
-1@@ -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 ;
hw/net/imx_fec.c static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value) · line 867
Quoted 10 lines
hw/net/imx_fec.c +1
-1break ;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 :
Applied.
Thanks
Quoted 23 lines · Jason Wang
Quoted 20 lines · 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 readvalue = 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 <[email protected]>Signed-off-by Chen Qun <[email protected]>---
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(-)
Quoted 11 lines
hw/net/imx_fec.c static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value) · line 859
Quoted 11 lines
hw/net/imx_fec.c +1
-1@@ -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 ;
Hi; the datasheet for this SoC says that these bits of the register are write-1-to-clear, so while this is definitely a bug I don't think this is the right fix.
Quoted 7 lines
hw/net/imx_fec.c static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value) · line 865
Quoted 7 lines
hw/net/imx_fec.c +1
-1case ENET_TCSR0 :case ENET_TCSR1 :case ENET_TCSR2 :case ENET_TCSR3 : - value = value &0x000000fd ; + s->regs[index] = value &0x000000fd ;break ;
Here bit 7 is write-1-to-clear, though bits 0 and 2..5 are simple write-the-value.
Quoted 5 lines
hw/net/imx_fec.c static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value) · line 867
Quoted 2 lines
hw/net/imx_fec.c +0
-0case ENET_TCCR0 :case ENET_TCCR1 :Applied.
Could you drop this from your queue, please?
thanks
-- PMM
Quoted 48 lines · Peter Maydell
Quoted 22 lines · Jason Wang
Quoted 20 lines · 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 readvalue = 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 <[email protected]>Signed-off-by Chen Qun <[email protected]>---
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(-)Quoted 11 lines
hw/net/imx_fec.c static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value) · line 859
Quoted 11 lines
hw/net/imx_fec.c +1
-1@@ -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 ;Hi; the datasheet for this SoC says that these bits of the register are write-1-to-clear, so while this is definitely a bug I don't think this is the right fix.
Quoted 7 lines
hw/net/imx_fec.c static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value) · line 865
Quoted 7 lines
hw/net/imx_fec.c +1
-1case ENET_TCSR0 :case ENET_TCSR1 :case ENET_TCSR2 :case ENET_TCSR3 : - value = value &0x000000fd ; + s->regs[index] = value &0x000000fd ;break ;Here bit 7 is write-1-to-clear, though bits 0 and 2..5 are simple write-the-value.
Quoted 8 lines
Quoted 4 lines
hw/net/imx_fec.c static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value) · line 867
Quoted 2 lines
hw/net/imx_fec.c +0
-0case ENET_TCCR0 :case ENET_TCCR1 :Applied.
Could you drop this from your queue, please?
thanks
-- PMM
Sure, Chen please send V2 to address Peter's comment.
Thanks
Quoted 66 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Wednesday, February 26, 2020 11:03 AM
To: Peter Maydell <[email protected]>
Cc: Chenqun (kuhn) <[email protected]>; QEMU Developers <[email protected]>; QEMU Trivial <[email protected]>; Zhanghailiang <[email protected]>; Peter Chubb <[email protected]>; qemu-arm <[email protected]>
Subject: Re: [PATCH] hw/net/imx_fec: write TGSR and TCSR3 inimx_enet_write()Quoted 23 lines · Peter Maydell
Quoted 22 lines · Jason Wang
Quoted 20 lines · 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 readvalue = 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 <[email protected]>Signed-off-by Chen Qun <[email protected]>---
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(-)Quoted 5 lines
Quoted 5 lines
hw/net/imx_fec.c static void imx_enet_write(IMXFECState *s,
Quoted 5 lines
hw/net/imx_fec.c index renamed from hw/net/imx_fec.c +0
-0
6a124a154a..92f6215712100644hw/net/imx_fec.c +0
-0@@ -855,13 +855,13 @@ static void imx_enet_write(IMXFECState *s,
uint32_tindex,uint32_tvalue)Quoted 23 lines
Quoted 6 lines
hw/net/imx_fec.c static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value) · line 859
Quoted 6 lines
hw/net/imx_fec.c +1
-1break ;case ENET_TGSR :/* implement clear timer flag */ - value = value &0x0000000f ; + s->regs[index] = value &0x0000000f ;break ;Hi; the datasheet for this SoC says that these bits of the register are write-1-to-clear, so while this is definitely a bug I don't think this is the right fix.
Quoted 7 lines
hw/net/imx_fec.c static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value) · line 865
Quoted 7 lines
hw/net/imx_fec.c +1
-1case ENET_TCSR0 :case ENET_TCSR1 :case ENET_TCSR2 :case ENET_TCSR3 : - value = value &0x000000fd ; + s->regs[index] = value &0x000000fd ;break ;Here bit 7 is write-1-to-clear, though bits 0 and
2..5 are simple write-the-value.Quoted 3 lines
Quoted 2 lines
hw/net/imx_fec.c +0
-0case ENET_TCCR0 :case ENET_TCCR1 :
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Applied.
Could you drop this from your queue, please?
thanks
-- PMMSure, Chen please send V2 to address Peter's comment.
OK, but I didn't find the datasheet that contains these two registers description. Could someone provide me with a connection for the datasheet ?