summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2019-09-09 06:00:02 -0700
committerJagan Teki <jagan@amarulasolutions.com>2020-01-27 22:27:21 +0530
commit7bacce524d48594dae399f9ee9280ab105f6c8cf (patch)
treea9cdb8e947d511b199db7647361b272ea6262a27 /include
parent383fded70c4f14370bc5525bdb9f547393876e31 (diff)
downloadu-boot-7bacce524d48594dae399f9ee9280ab105f6c8cf.tar.gz
u-boot-7bacce524d48594dae399f9ee9280ab105f6c8cf.tar.bz2
u-boot-7bacce524d48594dae399f9ee9280ab105f6c8cf.zip
dm: spi: Check cs number before accessing slaves
Add chip select number check in spi_find_chip_select(). Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Jagan Teki <jagan@amarulasolutions.com> # SoPine
Diffstat (limited to 'include')
-rw-r--r--include/spi.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/spi.h b/include/spi.h
index ba2c8406b2..18a0312f9f 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -561,7 +561,8 @@ int spi_chip_select(struct udevice *slave);
* @bus: SPI bus to search
* @cs: Chip select to look for
* @devp: Returns the slave device if found
- * @return 0 if found, -ENODEV on error
+ * @return 0 if found, -EINVAL if cs is invalid, -ENODEV if no device attached,
+ * other -ve value on error
*/
int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp);