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

Reply via email to