hw/nvram/eeprom_at24c: Remove memset after g_malloc0
authorBALATON Zoltan <balaton@eik.bme.hu>
Sat, 1 Mar 2025 14:35:35 +0000 (15:35 +0100)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Wed, 5 Mar 2025 01:13:36 +0000 (02:13 +0100)
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>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <ff281851e6d824ecd01b8b5cd955328dae1515a0.1740839457.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
hw/nvram/eeprom_at24c.c

index 9f606842eb65f16b0fa14645dbdccc279dd66c5f..78c81bea77f748c192781dcc5a44ec19970c3a68 100644 (file)
@@ -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));