mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 06:23:18 +02:00
treewide: Drop most cases of sizeof(struct ...)
Spelling out the struct type name hurts readability and introduces opportunities for bugs to happen when the pointer variable type is changed but the corresponding sizeof is (are) not. TEST=`make CONFIG_EVERYTHING=yes CONFIG_JLINK_SPI=no VERSION=none -j` with and without this patch; the flashrom executable does not change. Change-Id: Icc0b60ca6ef9f5ece6ed2a0e03600bb6ccd7dcc6 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55266 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:
@ -756,12 +756,12 @@ int probe_flash(struct registered_master *mst, int startchip, struct flashctx *f
|
||||
}
|
||||
|
||||
/* Start filling in the dynamic data. */
|
||||
flash->chip = calloc(1, sizeof(struct flashchip));
|
||||
flash->chip = calloc(1, sizeof(*flash->chip));
|
||||
if (!flash->chip) {
|
||||
msg_gerr("Out of memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
memcpy(flash->chip, chip, sizeof(struct flashchip));
|
||||
memcpy(flash->chip, chip, sizeof(*flash->chip));
|
||||
flash->mst = mst;
|
||||
|
||||
if (map_flash(flash) != 0)
|
||||
|
Reference in New Issue
Block a user