Skip to content

Commit

Permalink
spi-gpio: sanitize MISO bitvalue
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Buesch authored and Linus Torvalds committed Feb 18, 2009
1 parent 97bef7d commit be50344
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/spi/spi_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
return gpio_get_value(SPI_MISO_GPIO);
return !!gpio_get_value(SPI_MISO_GPIO);
}

#undef pdata
Expand Down

0 comments on commit be50344

Please sign in to comment.