From a4ca2223e176c38077aca03333ab07709fad84e7 Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Wed, 12 Jan 2022 13:37:48 +0100 Subject: [PATCH] Compile with -Wall and fix issues this revealed --- Makefile | 2 +- common.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cfa53f9..c44637d 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/common.c b/common.c index bfbf4f7..67c7e48 100644 --- a/common.c +++ b/common.c @@ -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;