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 <jwerner@chromium.org>
Change-Id: I3354ff0370ae79f05e5c37d292ac16d446898606
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57573
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Julius Werner 2021-09-10 19:08:48 -07:00 committed by Felix Held
parent 4c66daaadd
commit c1b98a43ae
1 changed files with 3 additions and 1 deletions

View File

@ -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;