diff options
author | Nico Huber <nico.h@gmx.de> | 2017-10-14 15:01:13 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2017-11-05 14:36:50 +0000 |
commit | 1f081530b60ee805532f106f59cc33973e160481 (patch) | |
tree | ebb7155eaeda5f891a435d4087e6532ccb8a15c5 | |
parent | 8b2152d54a67e4139525ce49aefe1a6d0e41b85c (diff) | |
download | flashrom-1f081530b60ee805532f106f59cc33973e160481.tar.gz flashrom-1f081530b60ee805532f106f59cc33973e160481.tar.bz2 flashrom-1f081530b60ee805532f106f59cc33973e160481.zip |
spi25_statusreg: Return defined value on failed RDSR
The interface of spi_read_status_register() is broken and can't return
errors. Let's not return random stack data at least.
Change-Id: I714b20001a5443bba665c2e0061ca14069777581
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/22017
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
-rw-r--r-- | spi25_statusreg.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/spi25_statusreg.c b/spi25_statusreg.c index 01a686299..05c7acfdc 100644 --- a/spi25_statusreg.c +++ b/spi25_statusreg.c @@ -117,8 +117,11 @@ uint8_t spi_read_status_register(struct flashctx *flash) /* Read Status Register */ ret = spi_send_command(flash, sizeof(cmd), sizeof(readarr), cmd, readarr); - if (ret) + if (ret) { msg_cerr("RDSR failed!\n"); + /* FIXME: We should propagate the error. */ + return 0; + } return readarr[0]; } |