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>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/55267
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71372
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/usbblaster_spi.c b/usbblaster_spi.c
index 58a8a0e..8059840 100644
--- a/usbblaster_spi.c
+++ b/usbblaster_spi.c
@@ -76,7 +76,7 @@
/* Returns 0 upon success, a negative number upon errors. */
int usbblaster_spi_init(void)
{
- uint8_t buf[BUF_SIZE + 1];
+ uint8_t buf[BUF_SIZE + 1] = { 0 };
if (ftdi_init(&ftdic) < 0)
return -1;
@@ -102,7 +102,6 @@
return -1;
}
- memset(buf, 0, sizeof(buf));
buf[sizeof(buf)-1] = BIT_LED | BIT_CS;
if (ftdi_write_data(&ftdic, buf, sizeof(buf)) < 0) {
msg_perr("USB-Blaster reset write failed\n");
@@ -119,9 +118,8 @@
static int send_write(unsigned int writecnt, const unsigned char *writearr)
{
- uint8_t buf[BUF_SIZE];
+ uint8_t buf[BUF_SIZE] = { 0 };
- memset(buf, 0, sizeof(buf));
while (writecnt) {
unsigned int i;
unsigned int n_write = min(writecnt, BUF_SIZE - 1);
@@ -146,8 +144,7 @@
{
int i;
unsigned int n_read;
- uint8_t buf[BUF_SIZE];
- memset(buf, 0, sizeof(buf));
+ uint8_t buf[BUF_SIZE] = { 0 };
n_read = readcnt;
while (n_read) {