diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2021-04-09 07:38:46 +0200 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2021-04-09 10:46:15 +0200 |
commit | 7c01e2bac1c2df1e10658b81e903fbd687c1a56b (patch) | |
tree | a39b400e7e2a6f26ef27ecd1368618e1aee4a979 /tools/firmware-utils | |
parent | e65b633a5b86928a00c5fe3b691144b351fe32cd (diff) | |
download | upstream-7c01e2bac1c2df1e10658b81e903fbd687c1a56b.tar.gz upstream-7c01e2bac1c2df1e10658b81e903fbd687c1a56b.tar.bz2 upstream-7c01e2bac1c2df1e10658b81e903fbd687c1a56b.zip |
firmware-utils: fix unused variable warnings
This fixes warnings from the:
1. -Wunused-variable
2. -Wunused-but-set-variable
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'tools/firmware-utils')
-rw-r--r-- | tools/firmware-utils/src/bcmalgo.c | 3 | ||||
-rw-r--r-- | tools/firmware-utils/src/dns313-header.c | 7 | ||||
-rw-r--r-- | tools/firmware-utils/src/imagetag.c | 9 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkcasfw.c | 9 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkcsysimg.c | 3 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkdniimg.c | 1 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkfwimage2.c | 1 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkmylofw.c | 6 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkplanexfw.c | 1 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkrtn56uimg.c | 9 | ||||
-rw-r--r-- | tools/firmware-utils/src/mktitanimg.c | 6 | ||||
-rw-r--r-- | tools/firmware-utils/src/mktplinkfw2.c | 1 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkzcfw.c | 8 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkzynfw.c | 3 | ||||
-rw-r--r-- | tools/firmware-utils/src/osbridge-crc.c | 1 | ||||
-rw-r--r-- | tools/firmware-utils/src/pc1crypt.c | 1 | ||||
-rw-r--r-- | tools/firmware-utils/src/spw303v.c | 1 | ||||
-rw-r--r-- | tools/firmware-utils/src/srec2bin.c | 3 | ||||
-rw-r--r-- | tools/firmware-utils/src/trx2edips.c | 4 | ||||
-rw-r--r-- | tools/firmware-utils/src/xorimage.c | 1 |
20 files changed, 18 insertions, 60 deletions
diff --git a/tools/firmware-utils/src/bcmalgo.c b/tools/firmware-utils/src/bcmalgo.c index e7d3b113be..c0865a183b 100644 --- a/tools/firmware-utils/src/bcmalgo.c +++ b/tools/firmware-utils/src/bcmalgo.c @@ -98,7 +98,6 @@ uint16_t get_hcs ( ldr_header_t* hd ) uint8_t hcs_minor; uint8_t hcs_major; uint16_t n = 0xffff; - uint16_t m = 0; int state = 0; int i,j; for ( i = 0; i < 0x54; i++ ) @@ -226,7 +225,7 @@ int dump_header ( ldr_header_t* hd ) printf ( "HNW:\t\t0x%04X\n",reverse_endian16 ( hd->her_znaet_chto ) ); //Hell knows what printf ( "CRC:\t\t0x%08X\n",reverse_endian32 ( hd->crc ) ); printf ( "=== Binary Header Dump===\n" ); - int i,j; + int i; uint8_t* head = ( uint8_t* ) hd; for ( i=0;i<=sizeof ( ldr_header_t );i++ ) { diff --git a/tools/firmware-utils/src/dns313-header.c b/tools/firmware-utils/src/dns313-header.c index ab34dd6d02..c5c70e1bbc 100644 --- a/tools/firmware-utils/src/dns313-header.c +++ b/tools/firmware-utils/src/dns313-header.c @@ -126,16 +126,13 @@ int main(int argc, char **argv) int fdout; struct stat sb; uint32_t filesize; - uint32_t padding; int ret = 0; const char *pathin; const char *pathout; unsigned char *buffer; - unsigned char *infop; uint32_t sum; size_t bufsize; size_t bytes; - int i; if (argc < 3) { printf("Too few arguments.\n"); @@ -150,7 +147,6 @@ int main(int argc, char **argv) return ret; filesize = sb.st_size; - padding = filesize % 4; printf("INFILE: %s, size: %08x bytes\n", pathin, filesize); /* File + extended header size */ bufsize = filesize + HEADER_SIZE; @@ -180,9 +176,6 @@ int main(int argc, char **argv) } close(fdin); - /* PREP HEADER AND FOOTER */ - infop = buffer; - be_wr(buffer + OFFSET_MAGIC, IH_MAGIC); /* FIXME: use actual time */ diff --git a/tools/firmware-utils/src/imagetag.c b/tools/firmware-utils/src/imagetag.c index bc70399cca..6b06bd785a 100644 --- a/tools/firmware-utils/src/imagetag.c +++ b/tools/firmware-utils/src/imagetag.c @@ -82,8 +82,8 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin, \ struct bcm_tag tag; struct kernelhdr khdr; FILE *kernelfile = NULL, *rootfsfile = NULL, *binfile = NULL, *cfefile = NULL; - size_t cfeoff, cfelen, kerneloff, kernellen, rootfsoff, rootfslen, \ - read, imagelen, rootfsoffpadlen = 0, kernelfslen, kerneloffpadlen = 0, oldrootfslen, \ + size_t cfelen, kerneloff, kernellen, rootfsoff, rootfslen, \ + read, imagelen, rootfsoffpadlen = 0, oldrootfslen, \ rootfsend; uint8_t readbuf[1024]; uint32_t imagecrc = IMAGETAG_CRC_START; @@ -91,7 +91,6 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin, \ uint32_t rootfscrc = IMAGETAG_CRC_START; uint32_t kernelfscrc = IMAGETAG_CRC_START; uint32_t fwaddr = 0; - uint8_t crc_val; const uint32_t deadcode = htonl(DEADCODE); int i; int is_pirelli = 0; @@ -126,7 +125,6 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin, \ fwaddr = flash_start + image_offset; if (cfefile) { - cfeoff = flash_start; cfelen = getlen(cfefile); /* Seek to the start of the file after tag */ fseek(binfile, sizeof(tag), SEEK_SET); @@ -138,7 +136,6 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin, \ } } else { - cfeoff = 0; cfelen = 0; } @@ -239,7 +236,6 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin, \ oldrootfslen = getlen(rootfsfile); rootfslen = oldrootfslen; rootfslen = ( (rootfslen % block_size) > 0 ? (((rootfslen / block_size) + 1) * block_size) : rootfslen ); - kerneloffpadlen = rootfslen - oldrootfslen; oldrootfslen = rootfslen; kerneloff = rootfsoff + rootfslen; @@ -391,7 +387,6 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin, \ int main(int argc, char **argv) { - int c, i; char *kernel, *rootfs, *bin; uint32_t flash_start, image_offset, block_size, load_address, entry; flash_start = image_offset = block_size = load_address = entry = 0; diff --git a/tools/firmware-utils/src/mkcasfw.c b/tools/firmware-utils/src/mkcasfw.c index 5655bf1894..eb92c8e3ff 100644 --- a/tools/firmware-utils/src/mkcasfw.c +++ b/tools/firmware-utils/src/mkcasfw.c @@ -763,8 +763,7 @@ write_out_header(FILE *outfile) int write_out_images(FILE *outfile) { - struct image_desc *desc; - int i, res; + int res; res = image_writeout(outfile, &kernel_image); if (res) @@ -839,7 +838,6 @@ parse_opt_image(char ch, char *arg) { char buf[MAX_ARG_LEN]; char *argv[MAX_ARG_COUNT]; - int argc; char *p; struct image_desc *desc = NULL; int i; @@ -864,7 +862,7 @@ parse_opt_image(char ch, char *arg) if (!desc) return ERR_FATAL; - argc = parse_arg(arg, buf, argv); + parse_arg(arg, buf, argv); i = 0; p = argv[i++]; @@ -886,9 +884,6 @@ parse_opt_image(char ch, char *arg) int process_images(void) { - struct image_desc *desc; - uint32_t offs = 0; - int i; int res; kernel_image.out_size = board->max_kernel_size; diff --git a/tools/firmware-utils/src/mkcsysimg.c b/tools/firmware-utils/src/mkcsysimg.c index 77fbbaa57f..7c0002c404 100644 --- a/tools/firmware-utils/src/mkcsysimg.c +++ b/tools/firmware-utils/src/mkcsysimg.c @@ -792,7 +792,6 @@ parse_opt_block(char ch, char *arg) { char buf[MAX_ARG_LEN]; char *argv[MAX_ARG_COUNT]; - int argc; char *p; struct csys_block *block; int i; @@ -854,7 +853,7 @@ parse_opt_block(char ch, char *arg) return ERR_FATAL; } - argc = parse_arg(arg, buf, argv); + parse_arg(arg, buf, argv); i = 0; p = argv[i++]; diff --git a/tools/firmware-utils/src/mkdniimg.c b/tools/firmware-utils/src/mkdniimg.c index 852b07dd9f..9111d3434b 100644 --- a/tools/firmware-utils/src/mkdniimg.c +++ b/tools/firmware-utils/src/mkdniimg.c @@ -50,7 +50,6 @@ static char *board_id; void usage(int status) { FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; - struct board_info *board; fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); fprintf(stream, diff --git a/tools/firmware-utils/src/mkfwimage2.c b/tools/firmware-utils/src/mkfwimage2.c index 9b7e1a3cd7..9d8b2f6f8b 100644 --- a/tools/firmware-utils/src/mkfwimage2.c +++ b/tools/firmware-utils/src/mkfwimage2.c @@ -65,7 +65,6 @@ typedef struct image_info { } image_info_t; static image_info_t im; -static int debug = 0; static int zero_part_baseaddr = 0; static void write_header(void* mem, const char* version) diff --git a/tools/firmware-utils/src/mkmylofw.c b/tools/firmware-utils/src/mkmylofw.c index b5958ebe0f..3ad743420f 100644 --- a/tools/firmware-utils/src/mkmylofw.c +++ b/tools/firmware-utils/src/mkmylofw.c @@ -848,14 +848,13 @@ parse_opt_id(char ch, char *arg) { char buf[MAX_ARG_LEN]; char *argv[MAX_ARG_COUNT]; - int argc; char *p; if (required_arg(ch, arg)) { goto err_out; } - argc = parse_arg(arg, buf, argv); + parse_arg(arg, buf, argv); /* processing vendor ID*/ p = argv[0]; @@ -1011,7 +1010,6 @@ parse_opt_partition(char ch, char *arg) { char buf[MAX_ARG_LEN]; char *argv[MAX_ARG_COUNT]; - int argc; char *p; struct mylo_partition *part; struct fw_part *fp; @@ -1028,7 +1026,7 @@ parse_opt_partition(char ch, char *arg) fp = &fw_parts[fw_num_partitions++]; part = &fp->mylo; - argc = parse_arg(arg, buf, argv); + parse_arg(arg, buf, argv); /* processing partition address */ p = argv[0]; diff --git a/tools/firmware-utils/src/mkplanexfw.c b/tools/firmware-utils/src/mkplanexfw.c index 0b71f80438..52145e63d6 100644 --- a/tools/firmware-utils/src/mkplanexfw.c +++ b/tools/firmware-utils/src/mkplanexfw.c @@ -105,7 +105,6 @@ static struct board_info *find_board(char *id) void usage(int status) { FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; - struct board_info *board; fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); fprintf(stream, diff --git a/tools/firmware-utils/src/mkrtn56uimg.c b/tools/firmware-utils/src/mkrtn56uimg.c index 92aaf314a1..6b72e1e233 100644 --- a/tools/firmware-utils/src/mkrtn56uimg.c +++ b/tools/firmware-utils/src/mkrtn56uimg.c @@ -102,7 +102,6 @@ static void usage(const char *progname, int status) { FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; - int i; fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); fprintf(stream, "\n" @@ -116,12 +115,12 @@ usage(const char *progname, int status) int process_image(char *progname, char *filename, op_mode_t opmode) { - int fd, len; - void *data, *ptr; + int fd; + void *ptr; char namebuf[IH_NMLEN]; struct stat sbuf; - uint32_t checksum, offset_kernel, offset_sqfs, offset_end, - offset_sec_header, offset_eb, offset_image_end; + uint32_t offset_kernel, offset_sqfs, offset_end, + offset_sec_header, offset_eb, offset_image_end; squashfs_sb_t *sqs; image_header_t *hdr; diff --git a/tools/firmware-utils/src/mktitanimg.c b/tools/firmware-utils/src/mktitanimg.c index 120d08f0c4..6f2b27a1f6 100644 --- a/tools/firmware-utils/src/mktitanimg.c +++ b/tools/firmware-utils/src/mktitanimg.c @@ -40,7 +40,6 @@ void print_help(void) void mknspimg_print_hdr(struct nsp_img_hdr *hdr) { struct nsp_img_hdr_chksum *chksum; - struct nsp_img_hdr_section_info *sect_info; struct nsp_img_hdr_sections *section; int i; @@ -118,14 +117,11 @@ int main(int argc, char* argv[], char* env[]) int cmdline_err; char* cmdline_error_msg; - char* filen_kernel; - char* filen_files; char* filen_out; int i,count; /* loop variables */ int num_sects = 2; /* We require exactly two image with -i option (see CMDLINE_CFG structure above) */ - int desc_count=0; int total = 0; int header_size=0; @@ -158,8 +154,6 @@ int main(int argc, char* argv[], char* env[]) header_version=atoi(argv[cmdline_getarg(cmdline_getarg_list('h'),0)]); } /* Set up arguments */ - filen_kernel = argv[cmdline_getarg(cmdline_getarg_list('i'),0)]; - filen_files = argv[cmdline_getarg(cmdline_getarg_list('i'),1)]; filen_out = argv[cmdline_getarg(cmdline_getarg_list('o'),0)]; /* Command line arguments have been parsed. Start doing our work. */ diff --git a/tools/firmware-utils/src/mktplinkfw2.c b/tools/firmware-utils/src/mktplinkfw2.c index e1c28e6347..053ff0050b 100644 --- a/tools/firmware-utils/src/mktplinkfw2.c +++ b/tools/firmware-utils/src/mktplinkfw2.c @@ -184,7 +184,6 @@ static struct flash_layout layouts[] = { static void usage(int status) { FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; - struct board_info *board; fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); fprintf(stream, diff --git a/tools/firmware-utils/src/mkzcfw.c b/tools/firmware-utils/src/mkzcfw.c index 2326f1ff5c..e21504e266 100644 --- a/tools/firmware-utils/src/mkzcfw.c +++ b/tools/firmware-utils/src/mkzcfw.c @@ -127,7 +127,6 @@ static struct board_info *find_board(char *id) static void usage(int status) { FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; - struct board_info *board; fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); fprintf(stream, @@ -276,8 +275,6 @@ static int build_fw(void) char *buf; char *p; int ret = EXIT_FAILURE; - int writelen = 0; - uint32_t crc; struct fw_header *hdr; struct fw_tail *tail; @@ -361,11 +358,6 @@ static int build_fw(void) int main(int argc, char *argv[]) { int ret = EXIT_FAILURE; - int err; - - FILE *outfile; - - progname = basename(argv[0]); while ( 1 ) { int c; diff --git a/tools/firmware-utils/src/mkzynfw.c b/tools/firmware-utils/src/mkzynfw.c index ccbabfe7f2..2cd769de2f 100644 --- a/tools/firmware-utils/src/mkzynfw.c +++ b/tools/firmware-utils/src/mkzynfw.c @@ -922,7 +922,6 @@ parse_opt_block(char ch, char *arg) { char buf[MAX_ARG_LEN]; char *argv[MAX_ARG_COUNT]; - int argc; char *p; struct fw_block *block; int i; @@ -951,7 +950,7 @@ parse_opt_block(char ch, char *arg) break; } - argc = parse_arg(arg, buf, argv); + parse_arg(arg, buf, argv); i = 0; p = argv[i++]; diff --git a/tools/firmware-utils/src/osbridge-crc.c b/tools/firmware-utils/src/osbridge-crc.c index 5fd236a074..519dd5f698 100644 --- a/tools/firmware-utils/src/osbridge-crc.c +++ b/tools/firmware-utils/src/osbridge-crc.c @@ -58,7 +58,6 @@ static char *ofname; void usage(int status) { FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; - struct board_info *board; fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); fprintf(stream, diff --git a/tools/firmware-utils/src/pc1crypt.c b/tools/firmware-utils/src/pc1crypt.c index fe41b3dab5..87f125a232 100644 --- a/tools/firmware-utils/src/pc1crypt.c +++ b/tools/firmware-utils/src/pc1crypt.c @@ -215,7 +215,6 @@ static int decrypt; void usage(int status) { FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; - struct board_info *board; fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); fprintf(stream, diff --git a/tools/firmware-utils/src/spw303v.c b/tools/firmware-utils/src/spw303v.c index 684532d7e1..9638b80a8a 100644 --- a/tools/firmware-utils/src/spw303v.c +++ b/tools/firmware-utils/src/spw303v.c @@ -167,7 +167,6 @@ int main(int argc, char **argv) char *ifn = NULL; char *ofn = NULL; int c; - int v0, v1, v2; size_t n; int first_block = 1; diff --git a/tools/firmware-utils/src/srec2bin.c b/tools/firmware-utils/src/srec2bin.c index 5cc71bda22..95a8195d1a 100644 --- a/tools/firmware-utils/src/srec2bin.c +++ b/tools/firmware-utils/src/srec2bin.c @@ -433,9 +433,8 @@ int srecLine(char *pSrecLine) int srec2bin(int argc,char *argv[],int verbose) { - int i,rlen,sts; + int rlen,sts; FILE *fp; - char ac; char buff[256]; bit32u TAG_BIG = 0xDEADBE42; bit32u TAG_LITTLE = 0xFEEDFA42; diff --git a/tools/firmware-utils/src/trx2edips.c b/tools/firmware-utils/src/trx2edips.c index f8d068d502..14c4eb70ba 100644 --- a/tools/firmware-utils/src/trx2edips.c +++ b/tools/firmware-utils/src/trx2edips.c @@ -140,6 +140,10 @@ int main(int argc, char *argv[]) rewind(fpIn); /* read the whole file*/ res = fread(buf, 1, length, fpIn); + if (res != length) { + fprintf(stderr, "Unable to fread from input file\n"); + return EXIT_FAILURE; + } p = (struct trx_header *)buf; if (LOAD32_LE(p->magic) != TRX_MAGIC) { diff --git a/tools/firmware-utils/src/xorimage.c b/tools/firmware-utils/src/xorimage.c index 2ca643faeb..4d1cd2d5de 100644 --- a/tools/firmware-utils/src/xorimage.c +++ b/tools/firmware-utils/src/xorimage.c @@ -61,7 +61,6 @@ int main(int argc, char **argv) char hex_pattern[128]; unsigned int hex_buf; int c; - int v0, v1, v2; size_t n; int p_len, p_off = 0; |