lkml.org 
[lkml]   [2015]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/4] spi: omap2-mcspi: Handle error on gpio_request
Date
If a valid GPIO is specified but cannot be requested by the driver, print a
message and error out of omap2_mcspi_setup.

Signed-off-by: Michael Welling <mwelling@ieee.org>
---
drivers/spi/spi-omap2-mcspi.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index c4e21ad..5867384 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1023,9 +1023,12 @@ static int omap2_mcspi_setup(struct spi_device *spi)
}

if (gpio_is_valid(spi->cs_gpio)) {
- if (gpio_request(spi->cs_gpio, dev_name(&spi->dev)) == 0)
- gpio_direction_output(spi->cs_gpio,
- !(spi->mode & SPI_CS_HIGH));
+ ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev));
+ if (ret) {
+ dev_err(&spi->dev, "failed to request gpio\n");
+ return ret;
+ }
+ gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
}

ret = pm_runtime_get_sync(mcspi->dev);
--
1.7.9.5


\
 
 \ /
  Last update: 2015-05-24 05:01    [W:0.077 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site