Skip to content

Commit

Permalink
spi: fsl-espi: avoid processing uninitalized data on error
Browse files Browse the repository at this point in the history
When we get a spurious interrupt in fsl_espi_irq, we end up
processing four uninitalized bytes of data, as shown in this
warning message:

   drivers/spi/spi-fsl-espi.c: In function 'fsl_espi_irq':
   drivers/spi/spi-fsl-espi.c:462:4: warning: 'rx_data' may be used uninitialized in this function [-Wmaybe-uninitialized]

This adds another check so we skip the data in this case.

Fixes: 6319a68 ("spi/fsl-espi: avoid infinite loops on fsl_espi_cpu_irq()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
  • Loading branch information
Arnd Bergmann authored and Mark Brown committed Oct 26, 2016
1 parent 1001354 commit 5c0ba57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/spi/spi-fsl-espi.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ static void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events)

mspi->len -= rx_nr_bytes;

if (mspi->rx)
if (rx_nr_bytes && mspi->rx)
mspi->get_rx(rx_data, mspi);
}

Expand Down

0 comments on commit 5c0ba57

Please sign in to comment.