From 7bacce524d48594dae399f9ee9280ab105f6c8cf Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Mon, 9 Sep 2019 06:00:02 -0700 Subject: dm: spi: Check cs number before accessing slaves Add chip select number check in spi_find_chip_select(). Signed-off-by: Bin Meng Tested-by: Jagan Teki # SoPine --- include/spi.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/spi.h') diff --git a/include/spi.h b/include/spi.h index ba2c840..18a0312 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); -- cgit v1.1