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

BALATON Zoltan posted 4 patches 3 days, 11 hours ago
[PATCH 3/4] hw/nvram/eeprom_at24c: Remove memset after g_malloc0
Posted by BALATON Zoltan 3 days, 11 hours ago
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(-)

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));
-- 
2.30.9
Re: [PATCH 3/4] hw/nvram/eeprom_at24c: Remove memset after g_malloc0
Posted by Philippe Mathieu-Daudé 1 day, 14 hours ago
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>