From 3bd47524c044168b01e54e772d23c7fa723dc0d5 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Mon, 7 Jun 2021 12:33:53 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/55266 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber Reviewed-by: Edward O'Callaghan --- lspcon_i2c_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lspcon_i2c_spi.c') diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c index 7f5e3efda..9a66b3121 100644 --- a/lspcon_i2c_spi.c +++ b/lspcon_i2c_spi.c @@ -446,7 +446,7 @@ int lspcon_i2c_spi_init(void) return ret; } - struct lspcon_i2c_spi_data *data = calloc(1, sizeof(struct lspcon_i2c_spi_data)); + struct lspcon_i2c_spi_data *data = calloc(1, sizeof(*data)); if (!data) { msg_perr("Unable to allocate space for extra SPI master data.\n"); i2c_close(fd); -- cgit v1.2.3