From 243f07be2423efe0b17e8ffafc9a36dad50406d3 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Tue, 20 Oct 2015 12:28:29 +0300 Subject: [PATCH] spi: core: use gpio_is_valid() helper Check if GPIO pin is valid by API helper function. Signed-off-by: Andy Shevchenko Signed-off-by: Mark Brown --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 64c1aedde481..9136f30a9fbd 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -606,7 +606,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable) if (spi->mode & SPI_CS_HIGH) enable = !enable; - if (spi->cs_gpio >= 0) + if (gpio_is_valid(spi->cs_gpio)) gpio_set_value(spi->cs_gpio, !enable); else if (spi->master->set_cs) spi->master->set_cs(spi, !enable); -- 2.20.1