spi: imx: fix potential shift truncation
authorGao Pan <pandy.gao@nxp.com>
Thu, 24 Nov 2016 11:04:43 +0000 (19:04 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 25 Nov 2016 13:04:42 +0000 (13:04 +0000)
There is a static checker warning in fsl_lpspi_set_cmd().
I intended to write "temp |= (fsl_lpspi->config.mode & 0x3) << 30",
but used "temp |= (fsl_lpspi->config.mode & 0x11) << 30" by mistake.

This patch fixes this potential shift truncation.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-lpspi.c

index d7ce32a..18a269d 100644 (file)
@@ -215,7 +215,7 @@ static void fsl_lpspi_set_cmd(struct fsl_lpspi_data *fsl_lpspi,
 
        temp |= fsl_lpspi->config.bpw - 1;
        temp |= fsl_lpspi->config.prescale << 27;
-       temp |= (fsl_lpspi->config.mode & 0x11) << 30;
+       temp |= (fsl_lpspi->config.mode & 0x3) << 30;
        temp |= (fsl_lpspi->config.chip_select & 0x3) << 24;
 
        /*