diff options
author | John Crispin <blogic@openwrt.org> | 2016-03-01 08:14:47 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2016-03-01 08:14:47 +0000 |
commit | 68492ba72f3ba612d156bbc546316a1473a0b07e (patch) | |
tree | 03e98d11bf5f20a3d7b5399814d28c6003eea3fd /tools/firmware-utils/src | |
parent | 483155ac899a033b9c657aab12b6b40097bdf840 (diff) | |
download | upstream-68492ba72f3ba612d156bbc546316a1473a0b07e.tar.gz upstream-68492ba72f3ba612d156bbc546316a1473a0b07e.tar.bz2 upstream-68492ba72f3ba612d156bbc546316a1473a0b07e.zip |
firmware-utils: mkfwimage: add -Wall, fix obvious bugs causing compile warnings
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of r48827
git-svn-id: svn://svn.openwrt.org/openwrt/branches/chaos_calmer@48846 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/firmware-utils/src')
-rw-r--r-- | tools/firmware-utils/src/mkfwimage.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c index e3a03c191c..00bf439afe 100644 --- a/tools/firmware-utils/src/mkfwimage.c +++ b/tools/firmware-utils/src/mkfwimage.c @@ -104,8 +104,6 @@ typedef struct part_data { #define OPTIONS "B:hv:m:o:r:k:" -static int debug = 0; - typedef struct image_info { char magic[16]; char version[256]; @@ -236,9 +234,9 @@ static int create_image_layout(const char* kernelfile, const char* rootfsfile, c fw_layout_t* p; p = &fw_layout_data[0]; - while ((strlen(p->name) != 0) && (strncmp(p->name, board_name, sizeof(board_name)) != 0)) + while (*p->name && (strcmp(p->name, board_name) != 0)) p++; - if (p->name == NULL) { + if (!*p->name) { printf("BUG! Unable to find default fw layout!\n"); exit(-1); } @@ -247,7 +245,7 @@ static int create_image_layout(const char* kernelfile, const char* rootfsfile, c strcpy(kernel->partition_name, "kernel"); kernel->partition_index = 1; kernel->partition_baseaddr = p->kern_start; - if ( (kernel->partition_length = filelength(kernelfile)) < 0) return (-1); + if ( (kernel->partition_length = filelength(kernelfile)) == (u_int32_t)-1) return (-1); kernel->partition_memaddr = p->kern_entry; kernel->partition_entryaddr = p->kern_entry; strncpy(kernel->filename, kernelfile, sizeof(kernel->filename)); @@ -263,8 +261,8 @@ static int create_image_layout(const char* kernelfile, const char* rootfsfile, c rootfs->partition_entryaddr = 0x00000000; strncpy(rootfs->filename, rootfsfile, sizeof(rootfs->filename)); -printf("kernel: %d 0x%08x\n", kernel->partition_length, kernel->partition_baseaddr); -printf("root: %d 0x%08x\n", rootfs->partition_length, rootfs->partition_baseaddr); + printf("kernel: %d 0x%08x\n", kernel->partition_length, kernel->partition_baseaddr); + printf("root: %d 0x%08x\n", rootfs->partition_length, rootfs->partition_baseaddr); im->part_count = 2; return 0; |