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>
This commit is contained in:
Patrick Rudolph 2018-11-07 15:23:40 +01:00 committed by Philipp Deppenwiese
parent ce3d8c2bae
commit b66907ac16
1 changed files with 2 additions and 2 deletions

View File

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