qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] hw/net/opencores_eth: Remove unnecessary address masking


From: Philippe Mathieu-Daudé
Subject: [PATCH 2/2] hw/net/opencores_eth: Remove unnecessary address masking
Date: Mon, 8 Jun 2020 11:15:08 +0200

The memory region is limited to 1 KiB, so the address is
garantied to be in that range. No need to mask.

  711 static const MemoryRegionOps open_eth_desc_ops = {
  712     .read = open_eth_desc_read,
  713     .write = open_eth_desc_write,
  714 };
  ...
  725     memory_region_init_io(&s->desc_io, OBJECT(dev),
  725                           &open_eth_desc_ops, s,
  726                           "open_eth.desc", 0x400);

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/net/opencores_eth.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c
index 90d3846bb7..0c9879e8a7 100644
--- a/hw/net/opencores_eth.c
+++ b/hw/net/opencores_eth.c
@@ -687,7 +687,6 @@ static uint64_t open_eth_desc_read(void *opaque,
     OpenEthState *s = opaque;
     uint64_t v = 0;
 
-    addr &= 0x3ff;
     memcpy(&v, (uint8_t *)s->desc + addr, size);
     trace_open_eth_desc_read((uint32_t)addr, (uint32_t)v);
     return v;
@@ -698,7 +697,6 @@ static void open_eth_desc_write(void *opaque,
 {
     OpenEthState *s = opaque;
 
-    addr &= 0x3ff;
     trace_open_eth_desc_write((uint32_t)addr, (uint32_t)val);
     memcpy((uint8_t *)s->desc + addr, &val, size);
     open_eth_check_start_xmit(s);
-- 
2.21.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]