From c1b98a43ae3493f3c91e432dfa49207a3b6a4ac4 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 10 Sep 2021 19:08:48 -0700 Subject: spi-generic: Print an error when trying to use a non-existent bus ...because I just spent hours chasing a refactoring bug that would have been way more obvious with a little more error transparency in here. Signed-off-by: Julius Werner Change-Id: I3354ff0370ae79f05e5c37d292ac16d446898606 Reviewed-on: https://review.coreboot.org/c/coreboot/+/57573 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/drivers/spi/spi-generic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/drivers/spi/spi-generic.c b/src/drivers/spi/spi-generic.c index 597a22dfea..116daf9088 100644 --- a/src/drivers/spi/spi-generic.c +++ b/src/drivers/spi/spi-generic.c @@ -123,8 +123,10 @@ int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave) } } - if (slave->ctrlr == NULL) + if (slave->ctrlr == NULL) { + printk(BIOS_ERR, "Can't find SPI bus %u\n", bus); return -1; + } slave->bus = bus; slave->cs = cs; -- cgit v1.2.3