From 9ef7782220d44e03b9455188c9850b780255f525 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Thu, 23 Jun 2022 13:01:08 -0400 Subject: [PATCH] Fix compilation with modern GCCs and improve code correctness --- src/stlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stlink.c b/src/stlink.c index cdd1f52..0d25c70 100644 --- a/src/stlink.c +++ b/src/stlink.c @@ -460,8 +460,8 @@ int stlink_flash(struct STLinkInfo *info, const char *filename) { uint32_t address = base_offset + flashed_bytes; uint32_t sector_start[8] = {0x08000000, 0x08004000, 0x08008000, 0x0800C000, 0x08010000, 0x08020000, 0x08040000, 0x08060000}; - int sector; - int i; + int sector = -1; + size_t i; for (i = 0; i < 8; i++) { if (sector_start[i] == address) { sector = i;