[PATCH] spi: synquacer: Silence unused variable warnings

Jagan Teki jagan at amarulasolutions.com
Tue Apr 25 19:36:52 CEST 2023


On Fri, Apr 7, 2023 at 2:43 PM 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>
> ---

Applied to u-boot-spi/master


More information about the U-Boot mailing list