From: Rafał Miłecki Date: Fri, 9 Apr 2021 07:21:25 +0000 (+0200) Subject: firmware-utils: fix -Wmaybe-uninitialized warnings X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=052a30d65e90ac9b3359f4a23aa3024d102c178c;p=openwrt%2Fstaging%2Fynezz.git firmware-utils: fix -Wmaybe-uninitialized warnings Signed-off-by: Rafał Miłecki --- diff --git a/tools/firmware-utils/src/asustrx.c b/tools/firmware-utils/src/asustrx.c index b3daeedcfd..04af9a184a 100644 --- a/tools/firmware-utils/src/asustrx.c +++ b/tools/firmware-utils/src/asustrx.c @@ -150,7 +150,8 @@ static void usage() { int main(int argc, char **argv) { struct trx_header hdr; struct asustrx_tail tail = { }; - FILE *in, *out; + FILE *out = NULL; + FILE *in = NULL; uint8_t buf[1024]; size_t bytes; size_t length = 0; diff --git a/tools/firmware-utils/src/mkcasfw.c b/tools/firmware-utils/src/mkcasfw.c index eb92c8e3ff..904000c78d 100644 --- a/tools/firmware-utils/src/mkcasfw.c +++ b/tools/firmware-utils/src/mkcasfw.c @@ -554,6 +554,10 @@ csum_get(struct csum_state *css) break; case CSUM_TYPE_32: ret = csum32_get(css); + break; + default: + ERR("invalid checksum size\n"); + return 0; } return ret; @@ -755,6 +759,9 @@ write_out_header(FILE *outfile) res = write_out_data(outfile, (uint8_t *)&tmp.nfs, sizeof(tmp.nfs), NULL); break; + default: + ERR("invalid header type\n"); + return -EINVAL; } return res; diff --git a/tools/firmware-utils/src/mkcsysimg.c b/tools/firmware-utils/src/mkcsysimg.c index 7c0002c404..e156f79153 100644 --- a/tools/firmware-utils/src/mkcsysimg.c +++ b/tools/firmware-utils/src/mkcsysimg.c @@ -493,6 +493,9 @@ csum_get(struct csum_state *css) case CSUM_SIZE_16: ret = csum16_get(css); break; + default: + ERR("invalid checksum size\n"); + return 0; } return ret; diff --git a/tools/firmware-utils/src/mkdapimg.c b/tools/firmware-utils/src/mkdapimg.c index 640f42d7c6..0031d83dd0 100644 --- a/tools/firmware-utils/src/mkdapimg.c +++ b/tools/firmware-utils/src/mkdapimg.c @@ -68,7 +68,8 @@ main(int ac, char *av[]) int fixmode = 0; int have_regionversion = 0; - FILE *ifile, *ofile; + FILE *ifile = NULL; + FILE *ofile = NULL; int c; uint32_t cksum; uint32_t bcnt; diff --git a/tools/firmware-utils/src/mkdapimg2.c b/tools/firmware-utils/src/mkdapimg2.c index 6b53c959b6..1d09290a16 100644 --- a/tools/firmware-utils/src/mkdapimg2.c +++ b/tools/firmware-utils/src/mkdapimg2.c @@ -92,7 +92,8 @@ main(int ac, char *av[]) char region[MAX_REG_LEN]; int kernel = 0; - FILE *ifile, *ofile; + FILE *ifile = NULL; + FILE *ofile = NULL; int c; uint32_t cksum; diff --git a/tools/firmware-utils/src/mkrtn56uimg.c b/tools/firmware-utils/src/mkrtn56uimg.c index 6b72e1e233..b6c891bbdc 100644 --- a/tools/firmware-utils/src/mkrtn56uimg.c +++ b/tools/firmware-utils/src/mkrtn56uimg.c @@ -251,7 +251,8 @@ int main(int argc, char **argv) { int opt; - char *filename, *progname; + char *filename = NULL; + char *progname; op_mode_t opmode = NONE; progname = argv[0];