Stefan Reinauer has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/37135 )
Change subject: WIP: More compiler warning fixes ......................................................................
WIP: More compiler warning fixes
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: Idf8e6364a8ebba78b7c793f745048bffbc03e3ef --- M Makefile M em100.c 2 files changed, 10 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/35/37135/1
diff --git a/Makefile b/Makefile index 1b5c2ba..15ba1f0 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ CFLAGS += -Wno-unused-but-set-variable CFLAGS += -DXZ_USE_CRC64 -DXZ_DEC_ANY_CHECK -Ixz # Remove after fixing -CFLAGS += -Wno-sign-compare -Wno-discarded-qualifiers +#CFLAGS += -Wno-sign-compare -Wno-discarded-qualifiers
LDFLAGS ?= LDFLAGS += $(shell $(PKG_CONFIG) --libs libusb-1.0) diff --git a/em100.c b/em100.c index 001ad5e..f21672c 100644 --- a/em100.c +++ b/em100.c @@ -72,7 +72,7 @@ printf("EM100Pro state unknown\n"); }
-static char * get_pin_string(int pin) { +static const char *get_pin_string(int pin) { switch (pin) { case 0: return ("low"); @@ -352,7 +352,7 @@ }
static int em100_attach(struct em100 *em100, int bus, int device, - int serial_number) + uint32_t serial_number) { libusb_device_handle *dev = NULL; libusb_context *ctx = NULL; @@ -726,7 +726,7 @@ return directory; }
-char *get_em100_file(char *name) +char *get_em100_file(const char *name) { char file[FILENAME_BUFFER_SIZE]; strncpy(file, get_em100_home(), FILENAME_BUFFER_SIZE); @@ -803,7 +803,7 @@ int firmware_is_dpfw = 0; unsigned int serial_number = 0; unsigned long address_offset = 0; - unsigned long spi_start_address = 0; + unsigned int spi_start_address = 0; const char *voltage = NULL;
while ((opt = getopt_long(argc, argv, "c:d:a:u:rsvtO:F:f:g:S:V:p:Dx:lUhT", @@ -817,8 +817,8 @@ /* TODO: check that file exists */ break; case 'a': - sscanf(optarg, "%lx", &spi_start_address); - printf("Spi address: 0x%08lx\n", spi_start_address); + sscanf(optarg, "%x", &spi_start_address); + printf("SPI address: 0x%08x\n", spi_start_address); break; case 'u': read_filename = optarg; @@ -989,7 +989,7 @@
if (!desiredchip) { /* Read configured SPI emulation from EM100 */ - const chipdesc emulated_chip; + chipdesc emulated_chip;
if (!get_chip_type(&em100, &emulated_chip)) { printf("Configured to emulate %s\n", emulated_chip.name); @@ -1024,7 +1024,7 @@ }
if (filename) { - int maxlen = desiredchip ? chip->size : 0x4000000; /* largest size - 64MB */ + unsigned int maxlen = desiredchip ? chip->size : 0x4000000; /* largest size - 64MB */ void *data = malloc(maxlen); int done; void *readback = NULL; @@ -1040,7 +1040,7 @@ return 1; }
- int length = 0; + unsigned int length = 0; while ((!feof(fdata)) && (length < maxlen)) { int blocksize = 65536; length += blocksize * fread(data+length, blocksize, 1,