Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1729976
| From | Christos Gkekas <chris.gekas@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] spi: stm32: Fix logical error in stm32_spi_prepare_mbr() |
| Date | 2017-09-10 16:00 +0200 |
| Message-ID | <uoaWd-4xL-3@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
stm32_spi_prepare_mbr() is returning an error value when div is less than SPI_MBR_DIV_MIN *and* greater than SPI_MBR_DIV_MAX, which always evaluates to false. This should change to use *or*. Signed-off-by: Christos Gkekas <chris.gekas@gmail.com> --- drivers/spi/spi-stm32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c index 680cdf5..ba9743f 100644 --- a/drivers/spi/spi-stm32.c +++ b/drivers/spi/spi-stm32.c @@ -263,8 +263,8 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz) * no need to check it there. * However, we need to ensure the following calculations. */ - if ((div < SPI_MBR_DIV_MIN) && - (div > SPI_MBR_DIV_MAX)) + if (div < SPI_MBR_DIV_MIN || + div > SPI_MBR_DIV_MAX) return -EINVAL; /* Determine the first power of 2 greater than or equal to div */ -- 2.7.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] spi: stm32: Fix logical error in stm32_spi_prepare_mbr() Christos Gkekas <chris.gekas@gmail.com> - 2017-09-10 16:00 +0200 Applied "spi: stm32: Fix logical error in stm32_spi_prepare_mbr()" to the spi tree Mark Brown <broonie@kernel.org> - 2017-09-13 19:10 +0200
csiph-web