diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2016-12-14 12:20:55 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-12-14 14:31:13 +0000 |
commit | cc4a7ffe02c95f537541c91e9842e3710decae6e (patch) | |
tree | fea0220214eaeaaf04ca80e8127acf984f7b97fa /drivers/spi/spi-fsl-lpspi.c | |
parent | fafd67940774733fa97f4b09412aea6981b82e0a (diff) | |
download | lwn-cc4a7ffe02c95f537541c91e9842e3710decae6e.tar.gz lwn-cc4a7ffe02c95f537541c91e9842e3710decae6e.zip |
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@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-fsl-lpspi.c')
-rw-r--r-- | drivers/spi/spi-fsl-lpspi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index 52551f6d0c7d..2b93bc605b91 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -366,7 +366,7 @@ static int fsl_lpspi_transfer_one_msg(struct spi_master *master, struct spi_transfer *xfer; bool is_first_xfer = true; u32 temp; - int ret; + int ret = 0; msg->status = 0; msg->actual_length = 0; |