提交 be50344e 编写于 作者: M Michael Buesch 提交者: Linus Torvalds

spi-gpio: sanitize MISO bitvalue

gpio_get_value() returns 0 or nonzero, but getmiso() expects 0 or 1.
Sanitize the value to a 0/1 boolean.
Signed-off-by: NMichael Buesch <mb@bu3sch.de>
Acked-by: NDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 97bef7dd
...@@ -114,7 +114,7 @@ static inline void setmosi(const struct spi_device *spi, int is_on) ...@@ -114,7 +114,7 @@ static inline void setmosi(const struct spi_device *spi, int is_on)
static inline int getmiso(const struct spi_device *spi) static inline int getmiso(const struct spi_device *spi)
{ {
return gpio_get_value(SPI_MISO_GPIO); return !!gpio_get_value(SPI_MISO_GPIO);
} }
#undef pdata #undef pdata
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册