Compile with -Wall and fix issues this revealed

This commit is contained in:
Ondrej Jirman 2022-01-12 13:37:48 +01:00
parent 457e5658d9
commit a4ca2223e1
2 changed files with 3 additions and 2 deletions

View file

@ -2,7 +2,7 @@ VERSION := $(shell git describe) $(shell git log -1 --format=%cd --date=iso)
OUT ?= build/
CFLAGS ?= -O2 -g0
CFLAGS += -DVERSION="\"$(VERSION)\"" -I. -I$(OUT)
CFLAGS += -DVERSION="\"$(VERSION)\"" -I. -I$(OUT) -Wall -Wno-unused-variable -Wno-unused-function
all: $(OUT)ppkb-i2c-inputd $(OUT)ppkb-usb-flasher $(OUT)ppkb-usb-debugger $(OUT)fw-stock.bin $(OUT)ppkb-i2c-debugger $(OUT)ppkb-i2c-charger-ctl $(OUT)ppkb-i2c-flasher $(OUT)ppkb-i2c-selftest

View file

@ -46,6 +46,7 @@ static void syscall_error(int is_err, const char* fmt, ...)
exit(1);
}
__attribute__((noreturn))
static void error(const char* fmt, ...)
{
va_list ap;
@ -84,7 +85,7 @@ static bool read_file(const char* path, char* buf, size_t size)
static int open_usb_dev(uint16_t vid, uint16_t pid)
{
char path[256], buf[256];
char path[512], buf[256];
struct dirent *e;
unsigned e_vid, e_pid, bus, dev;
int fd = -1, ret;