diff mbox series

[3/4] hw/nvram/eeprom_at24c: Remove memset after g_malloc0

Message ID ff281851e6d824ecd01b8b5cd955328dae1515a0.1740839457.git.balaton@eik.bme.hu (mailing list archive)
State New
Headers show
Series Misc eeprom_at24c clean ups | expand

Commit Message

BALATON Zoltan March 1, 2025, 2:35 p.m. UTC
Calling memset to zero memory is not needed after g_malloc0 which
already clears memory. These used to be in separate functions but
after some patches the memset ended up after g_malloc0 and thus can be
dropped.

Fixes: 4f2c6448c3 (hw/nvram/eeprom_at24c: Make reset behavior more like hardware)
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/nvram/eeprom_at24c.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Philippe Mathieu-Daudé March 3, 2025, 11:20 a.m. UTC | #1
On 1/3/25 15:35, BALATON Zoltan wrote:
> Calling memset to zero memory is not needed after g_malloc0 which
> already clears memory. These used to be in separate functions but
> after some patches the memset ended up after g_malloc0 and thus can be
> dropped.
> 
> Fixes: 4f2c6448c3 (hw/nvram/eeprom_at24c: Make reset behavior more like hardware)
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>   hw/nvram/eeprom_at24c.c | 1 -
>   1 file changed, 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c
index 9f606842eb..78c81bea77 100644
--- a/hw/nvram/eeprom_at24c.c
+++ b/hw/nvram/eeprom_at24c.c
@@ -190,7 +190,6 @@  static void at24c_eeprom_realize(DeviceState *dev, Error **errp)
     }
 
     ee->mem = g_malloc0(ee->rsize);
-    memset(ee->mem, 0, ee->rsize);
 
     if (ee->init_rom) {
         memcpy(ee->mem, ee->init_rom, MIN(ee->init_rom_size, ee->rsize));