From 5c588e7a84d5e0aff9b16bdfbb196c27ed445484 Mon Sep 17 00:00:00 2001 From: Hubert Badocha Date: Fri, 27 Sep 2024 17:24:58 +0200 Subject: [PATCH] misc: refactor to remove new gcc warnings JIRA: RTOS-927 --- sensors/libsensors-spi.c | 4 ++-- storage/zynq7000-flash/qspi.c | 4 ++-- tty/zynq7000-uart/zynq7000-uart.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sensors/libsensors-spi.c b/sensors/libsensors-spi.c index c1d3ecd72..0044d2cef 100644 --- a/sensors/libsensors-spi.c +++ b/sensors/libsensors-spi.c @@ -107,7 +107,7 @@ int sensorsspi_open(const char *devSPI, const char *devSS, oid_t *spi, oid_t *ss /* Configure pin as output */ dir = dirname(path); - sprintf(dir, "%s/dir", dir); + strcat(dir, "/dir"); ntries = 10; while (lookup(dir, NULL, &oid) < 0) { @@ -127,7 +127,7 @@ int sensorsspi_open(const char *devSPI, const char *devSS, oid_t *spi, oid_t *ss /* Raise SS pin high */ dir = dirname(path); - sprintf(dir, "%s/port", dir); + strcat(dir, "/port"); ntries = 10; while (lookup(dir, NULL, &oid) < 0) { diff --git a/storage/zynq7000-flash/qspi.c b/storage/zynq7000-flash/qspi.c index 6261baa0a..c541433d3 100644 --- a/storage/zynq7000-flash/qspi.c +++ b/storage/zynq7000-flash/qspi.c @@ -405,7 +405,7 @@ static int qspi_setPin(uint32_t pin) static int qspi_initPins(void) { - int res, i; + int res = EOK; static const int pins[] = { QSPI_CS, QSPI_IO0, @@ -416,7 +416,7 @@ static int qspi_initPins(void) QSPI_FCLK }; - for (i = 0; i < sizeof(pins) / sizeof(pins[0]); ++i) { + for (size_t i = 0; i < (sizeof(pins) / sizeof(pins[0])); ++i) { /* Pin should not be configured by the driver */ if (pins[i] < 0) { continue; diff --git a/tty/zynq7000-uart/zynq7000-uart.c b/tty/zynq7000-uart/zynq7000-uart.c index 209edc356..e6310b878 100644 --- a/tty/zynq7000-uart/zynq7000-uart.c +++ b/tty/zynq7000-uart/zynq7000-uart.c @@ -314,7 +314,7 @@ static void uart_klogClbk(const char *data, size_t size) static void uart_mkDev(unsigned int id) { - char path[12]; + char path[20]; snprintf(path, sizeof(path), "/dev/uart%u", id); if (create_dev(&uart_common.uart.oid, path) < 0) {