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 22:35:35 +0000 |
commit | fcbdc0a00763217828792c8c95069154117dc68b (patch) | |
tree | 1b4c44d305f37b7374779ab435e249d597a21be7 | |
parent | c2a11296e3c906a193f7329d1168a515cc4943dd (diff) | |
download | flashrom-fcbdc0a00763217828792c8c95069154117dc68b.tar.gz flashrom-fcbdc0a00763217828792c8c95069154117dc68b.tar.bz2 flashrom-fcbdc0a00763217828792c8c95069154117dc68b.zip |
spi25_statusreg: Return defined value on failed RDSRv1.0-rc1
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>
(cherry picked from commit 1f081530b60ee805532f106f59cc33973e160481)
Reviewed-on: https://review.coreboot.org/22349
-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]; } |