xilinx_axienet: Fix bit mask code
PATCH 1/1 xilinx_axienet: Fix bit mask code
Obviously the code wanted to mask the lower bits but failed to do so because of a missing "<".
cppcheck detected a conditional expression which was always true (1 < 7).
---
Please review - I did not look for a Xilinx manual to see whether the code was correct at all.
Regards,
Stefan Weil
hw/net/xilinx_axienet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/xilinx_axienet.c +1 -1
@@ -575,7 +575,7 @@ static void enet_write(void *opaque, hwaddr addr,break ;case R_MC : - value &= ((1 <7 ) -1 ); + value &= ((1 <<7 ) -1 );/* Enable the MII. */ if (value &MC_EN ) {
Signature · 1 line
1.7.10.4
hw/net/xilinx_axienet.c static void enet_write(void *opaque, hwaddr addr, · line 578
Quoted 10 lines · Stefan Weil
hw/net/xilinx_axienet.c +1
-1@@ -575,7 +575,7 @@ static void enet_write(void *opaque, hwaddr addr,break ;case R_MC : - value &= ((1 <7 ) -1 ); + value &= ((1 <<7 ) -1 );
Whoops. No objection to this patch as it stands; another option would be
value = extract32(value, 0, 7);
thanks
-- PMM
Edgar E. Iglesias
AppliedQuoted 4 lines · Stefan Weil
Obviously the code wanted to mask the lower bits but failed to do so because of a missing "<".
cppcheck detected a conditional expression which was always true (1 < 7).
Applied, thanks Stefan
Quoted 29 lines
Signed-off-by Stefan Weil <[email protected]>---
Please review - I did not look for a Xilinx manual to see whether the code was correct at all.
Regards,
Stefan Weilhw/net/xilinx_axienet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/net/xilinx_axienet.c +1
-1@@ -575,7 +575,7 @@ static void enet_write(void *opaque, hwaddr addr,break ;case R_MC : - value &= ((1 <7 ) -1 ); + value &= ((1 <<7 ) -1 );/* Enable the MII. */ if (value &MC_EN ) {Signature · 1 line
1.7.10.4