RE: [PATCH] spi: fsl-lpspi: Pre-initialize ret in fsl_lpspi_transfer_one_msg()

From: Pandy Gao
Date: Thu Dec 15 2016 - 08:35:58 EST


> From: Geert Uytterhoeven [mailto:geert@xxxxxxxxxxxxxx]
> Sent: Wednesday, December 14, 2016 7:21 PM
> To: Mark Brown <broonie@xxxxxxxxxx>; Pandy Gao
> <pandy.gao@xxxxxxx>
> Cc: linux-spi@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Geert
> Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Subject: [PATCH] spi: fsl-lpspi: Pre-initialize ret in
> fsl_lpspi_transfer_one_msg()
>
> With gcc 4.1.2:
>
> drivers/spi/spi-fsl-lpspi.c: In function âfsl_lpspi_transfer_one_msgâ:
> drivers/spi/spi-fsl-lpspi.c:369: warning: âretâ may be used uninitialized
> in this function
>
> If the message contains no transfers, the function will set the message's
> status to an uninitialized value, and will return that uninitialized value.
>
> While __spi_validate() should have been called in all paths leading to this,
> and thus have rejected such messages, we better pre-initialize ret to be
> safe for future modifications (spi_transfer_one_message() also does this).
>
> Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> ---

Acked-by: Gao Pan <pandy.gao@xxxxxxx>

Best Regards
Pandy