mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 14:11:15 +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:
@ -1579,19 +1579,19 @@ loop_end:
|
||||
(request_enable == RAIDEN_DEBUG_SPI_REQ_ENABLE_EC))
|
||||
usleep(50 * 1000);
|
||||
|
||||
struct spi_master *spi_config = calloc(1, sizeof(struct spi_master));
|
||||
struct spi_master *spi_config = calloc(1, sizeof(*spi_config));
|
||||
if (!spi_config) {
|
||||
msg_perr("Unable to allocate space for SPI master.\n");
|
||||
return SPI_GENERIC_ERROR;
|
||||
}
|
||||
struct raiden_debug_spi_data *data = calloc(1, sizeof(struct raiden_debug_spi_data));
|
||||
struct raiden_debug_spi_data *data = calloc(1, sizeof(*data));
|
||||
if (!data) {
|
||||
free(spi_config);
|
||||
msg_perr("Unable to allocate space for extra SPI master data.\n");
|
||||
return SPI_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
memcpy(spi_config, &spi_master_raiden_debug, sizeof(struct spi_master));
|
||||
memcpy(spi_config, &spi_master_raiden_debug, sizeof(*spi_config));
|
||||
|
||||
data->dev = device;
|
||||
data->in_ep = in_endpoint;
|
||||
|
Reference in New Issue
Block a user