Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/55267 )
Change subject: treewide: Drop unnecessary uses of memset/memcpy ......................................................................
treewide: Drop unnecessary uses of memset/memcpy
Simply provide an initialiser or use a direct assignment instead.
Change-Id: I07385375cd8eec8a95874001b402b2c17ec09e09 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M flashrom.c M ichspi.c M raiden_debug_spi.c 3 files changed, 3 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/67/55267/1
diff --git a/flashrom.c b/flashrom.c index fcaa3ef..60d8321 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1239,7 +1239,7 @@ msg_gerr("Out of memory!\n"); exit(1); } - memcpy(flash->chip, chip, sizeof(*flash->chip)); + *flash->chip = *chip; flash->mst = mst;
if (map_flash(flash) != 0) diff --git a/ichspi.c b/ichspi.c index 20dac1b..091e4e2 100644 --- a/ichspi.c +++ b/ichspi.c @@ -1720,7 +1720,7 @@ char *arg; int ich_spi_rw_restricted = 0; int desc_valid = 0; - struct ich_descriptors desc; + struct ich_descriptors desc = { 0 }; enum ich_spi_mode { ich_auto, ich_hwseq, @@ -1731,8 +1731,6 @@ ich_generation = ich_gen; ich_spibar = spibar;
- memset(&desc, 0x00, sizeof(desc)); - /* Moving registers / bits */ switch (ich_gen) { case CHIPSET_100_SERIES_SUNRISE_POINT: diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c index 950b8af..ef4757b 100644 --- a/raiden_debug_spi.c +++ b/raiden_debug_spi.c @@ -1591,7 +1591,7 @@ return SPI_GENERIC_ERROR; }
- memcpy(spi_config, &spi_master_raiden_debug, sizeof(*spi_config)); + *spi_config = spi_master_raiden_debug;
data->dev = device; data->in_ep = in_endpoint;