[PATCH] spi: synquacer: Silence unused variable warnings

Jassi Brar jaswinder.singh at linaro.org
Sat Apr 8 17:01:31 CEST 2023


On Fri, 7 Apr 2023 at 04:13, Ilias Apalodimas
<ilias.apalodimas at linaro.org> wrote:
>
> 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 at linaro.org>
>
Acked-by: Jassi Brar <jaswinder.singh at linaro.org>


More information about the U-Boot mailing list