Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Michael Buesch <mb@bu3sch.de>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Michael Buesch and committed by
Linus Torvalds
be50344e 97bef7dd

+1 -1
+1 -1
drivers/spi/spi_gpio.c
··· 114 114 115 115 static inline int getmiso(const struct spi_device *spi) 116 116 { 117 - return gpio_get_value(SPI_MISO_GPIO); 117 + return !!gpio_get_value(SPI_MISO_GPIO); 118 118 } 119 119 120 120 #undef pdata