diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-06-07 13:29:13 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2021-06-09 16:07:45 +0000 |
commit | f41d24823c1703e328fc27588bbcf3c96eecdbc9 (patch) | |
tree | 3bd19f60db955c7206fa72a1ccdb7a2607e7001d /usbblaster_spi.c | |
parent | 3bd47524c044168b01e54e772d23c7fa723dc0d5 (diff) | |
download | flashrom-f41d24823c1703e328fc27588bbcf3c96eecdbc9.tar.gz flashrom-f41d24823c1703e328fc27588bbcf3c96eecdbc9.tar.bz2 flashrom-f41d24823c1703e328fc27588bbcf3c96eecdbc9.zip |
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>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/55267
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'usbblaster_spi.c')
-rw-r--r-- | usbblaster_spi.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/usbblaster_spi.c b/usbblaster_spi.c index 115876e88..5f240df93 100644 --- a/usbblaster_spi.c +++ b/usbblaster_spi.c @@ -74,9 +74,8 @@ static uint8_t reverse(uint8_t b) static int send_write(unsigned int writecnt, const unsigned char *writearr, struct ftdi_context ftdic) { - 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); @@ -101,8 +100,7 @@ static int send_read(unsigned int readcnt, unsigned char *readarr, struct ftdi_c { 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) { @@ -181,7 +179,7 @@ static const struct spi_master spi_master_usbblaster = { /* 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 }; struct ftdi_context ftdic; struct usbblaster_spi_data *usbblaster_data; @@ -209,7 +207,6 @@ int usbblaster_spi_init(void) 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"); |