staging: wfx: fix uninitialized variable bytes_done

The variable bytes_done is not initialized and hence the first
FIFO size check on bytes_done may be breaking prematurely from
the loop if bytes_done contains a large bogus uninitialized value.
Fix this by initializing bytes_done to zero.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: a9408ad79f ("staging: wfx: load the firmware faster")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200706132017.487627-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Colin Ian King 2020-07-06 14:20:17 +01:00 committed by Greg Kroah-Hartman
parent 14442181d2
commit d4e03146b0
1 changed files with 1 additions and 1 deletions

View File

@ -177,7 +177,7 @@ static int wait_ncp_status(struct wfx_dev *wdev, u32 status)
static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len)
{
int ret;
u32 offs, bytes_done;
u32 offs, bytes_done = 0;
ktime_t now, start;
if (len % DNLD_BLOCK_SIZE) {