summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2018-11-07 15:23:40 +0100
committerPhilipp Deppenwiese <zaolin.daisuki@gmail.com>2018-11-08 11:08:16 +0000
commitb66907ac16394e8d2eb4194199fd65a5c66e49fd (patch)
tree7817dc6c865817621f3bab4f7c1d2bdbcfa69134 /src/drivers
parentce3d8c2bae9393c94dd332b37c5f18fbff808a14 (diff)
drivers/spi: Return error in failure case
In case the function pointer isn't set return an error. Change-Id: I9de300f651ac93889dafa7377c876bf5ae2c50cc Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/29531 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/spi/spi_flash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index cc21ccb20e..b0b58993a6 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -448,7 +448,7 @@ int spi_flash_is_write_protected(const struct spi_flash *flash,
if (!flash->ops->get_write_protection) {
printk(BIOS_WARNING, "SPI: Write-protection gathering not "
"implemented for this vendor.\n");
- return 0;
+ return -1;
}
return flash->ops->get_write_protection(flash, region);
@@ -473,7 +473,7 @@ int spi_flash_set_write_protected(const struct spi_flash *flash,
if (!flash->ops->set_write_protection) {
printk(BIOS_WARNING, "SPI: Setting write-protection is not "
"implemented for this vendor.\n");
- return 0;
+ return -1;
}
ret = flash->ops->set_write_protection(flash, region, non_volatile,