mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 14:11:15 +02:00
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>
This commit is contained in:
@ -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");
|
||||
|
Reference in New Issue
Block a user