diff mbox series

[2/3] secvar_api: check that enqueue_update writes successfully before returning success

Message ID 20191204000349.28397-3-erichte@linux.ibm.com
State Accepted
Headers show
Series Minor Secure Variable-related fixes | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch master (d75e82dbfbb9443efeb3f9a5921ac23605aab469)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Eric Richter Dec. 4, 2019, 12:03 a.m. UTC
The return code to the storage driver's write function was previously
being ignored, so failures to write were not propogated to the API
consumer. This patch fixes secvar_enqueue_update() to properly return
the expected OPAL_HARDWARE return code if the storage driver's write
function returns an error.

Signed-off-by: Eric Richter <erichte@linux.ibm.com>
---
 libstb/secvar/secvar_api.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libstb/secvar/secvar_api.c b/libstb/secvar/secvar_api.c
index 2dd2638b..349e8bef 100644
--- a/libstb/secvar/secvar_api.c
+++ b/libstb/secvar/secvar_api.c
@@ -151,8 +151,9 @@  static int64_t opal_secvar_enqueue_update(const char *key, uint64_t key_len, voi
 	list_add_tail(&update_bank, &node->link);
 
 out:
-	secvar_storage.write_bank(&update_bank, SECVAR_UPDATE_BANK);
-
-	return OPAL_SUCCESS;
+	if (secvar_storage.write_bank(&update_bank, SECVAR_UPDATE_BANK))
+		return OPAL_HARDWARE;
+	else
+		return OPAL_SUCCESS;
 }
 opal_call(OPAL_SECVAR_ENQUEUE_UPDATE, opal_secvar_enqueue_update, 4);