Message ID | ff281851e6d824ecd01b8b5cd955328dae1515a0.1740839457.git.balaton@eik.bme.hu (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Misc eeprom_at24c clean ups | expand |
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 --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));
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(-)