diff options
author | Michael Welling <mwelling@ieee.org> | 2015-05-23 21:13:45 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-05-25 13:00:04 +0100 |
commit | c4339ac775b0558373bb6882b8355cf6e85d5709 (patch) | |
tree | b1a81d97d4e4f2b147f13817c58c05ceba0ce422 /drivers/spi | |
parent | a06b430fd82c816bf76fb6f6f63f1ae1ced3b897 (diff) |
spi: omap2-mcspi: Handle error on gpio_request
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-omap2-mcspi.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index c4e21adb9bf7..58673841286c 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); |