diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-05-13 18:27:18 +0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-05-13 18:27:18 +0400 |
commit | 88b0357dde1c2721a64268e4601d1c2dec1158b0 (patch) | |
tree | a86c0af317bbb3f501c4d5b3517b02640a9f69c0 /drivers/spi/spi.c | |
parent | 0faa3146f17295f612abadafbfe3d4346178f10f (diff) | |
parent | 3086c9f6482101b3c06935cdfb4d4b56adb60097 (diff) |
Merge remote-tracking branch 'spi/fix/grant' into spi-linus
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 163fd802b7a..32b7bb111eb 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -334,7 +334,7 @@ struct spi_device *spi_alloc_device(struct spi_master *master) spi->dev.parent = &master->dev; spi->dev.bus = &spi_bus_type; spi->dev.release = spidev_release; - spi->cs_gpio = -EINVAL; + spi->cs_gpio = -ENOENT; device_initialize(&spi->dev); return spi; } @@ -1067,8 +1067,11 @@ static int of_spi_register_master(struct spi_master *master) nb = of_gpio_named_count(np, "cs-gpios"); master->num_chipselect = max(nb, (int)master->num_chipselect); - if (nb < 1) + /* Return error only for an incorrectly formed cs-gpios property */ + if (nb == 0 || nb == -ENOENT) return 0; + else if (nb < 0) + return nb; cs = devm_kzalloc(&master->dev, sizeof(int) * master->num_chipselect, @@ -1079,7 +1082,7 @@ static int of_spi_register_master(struct spi_master *master) return -ENOMEM; for (i = 0; i < master->num_chipselect; i++) - cs[i] = -EINVAL; + cs[i] = -ENOENT; for (i = 0; i < nb; i++) cs[i] = of_get_named_gpio(np, "cs-gpios", i); |