mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 05:38:00 +00:00
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>
This commit is contained in:
parent
e65b633a5b
commit
7c01e2bac1
@ -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++ )
|
||||
{
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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++];
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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];
|
||||
|
@ -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,
|
||||
|
@ -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,11 +115,11 @@ 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,
|
||||
uint32_t offset_kernel, offset_sqfs, offset_end,
|
||||
offset_sec_header, offset_eb, offset_image_end;
|
||||
squashfs_sb_t *sqs;
|
||||
image_header_t *hdr;
|
||||
|
@ -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. */
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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++];
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user