]> git.dujemihanovic.xyz Git - u-boot.git/commit
spi: synquacer: Silence uninitialized variable warnings
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Fri, 7 Apr 2023 09:13:00 +0000 (12:13 +0300)
committerJagan Teki <jagan@amarulasolutions.com>
Tue, 25 Apr 2023 17:36:10 +0000 (23:06 +0530)
commit8485595927e1685a8369426bda91b6a89dc2754c
treea4ddd4c20bb8e3f08bf08edd2a3f45874f523b2e
parent24c27b3c6ceab7295d12cd2ae0a47cfe9c136ecc
spi: synquacer: Silence uninitialized variable warnings

When building with clang, the compiler compains with

drivers/spi/spi-synquacer.c:212:11: warning: variable 'bus_width' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        else if (priv->mode & SPI_TX_OCTAL)
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-synquacer.c:276:11: note: uninitialized use occurs here
        val |= ((bus_width >> 1) << BUS_WIDTH);
                 ^~~~~~~~~
drivers/spi/spi-synquacer.c:212:7: note: remove the 'if' if its condition is always true
        else if (priv->mode & SPI_TX_OCTAL)
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-synquacer.c:189:25: note: initialize the variable 'bus_width' to silence this warning

So initialize bus_width to 1 and add a warning if none of the configured
modes matches

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
drivers/spi/spi-synquacer.c