[PATCH] state: hmac: fix error message that algo is displayed
Marc Kleine-Budde
mkl at pengutronix.de
Thu Jan 14 01:52:54 PST 2016
This patch moves the error message about missing crypto support so that the
used crypto algo is printed. Without this patch the algo is always shown as a
NULL pointer.
Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>
---
common/state.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/state.c b/common/state.c
index d1fa47ffa34e..3e95efd91168 100644
--- a/common/state.c
+++ b/common/state.c
@@ -1583,6 +1583,10 @@ static int state_backend_raw_file_init_digest(struct state *state, struct state_
if (!p) /* does not exist */
return 0;
+ ret = of_property_read_string(state->root, "algo", &algo);
+ if (ret)
+ return ret;
+
if (!IS_ENABLED(CONFIG_STATE_CRYPTO)) {
dev_err(&state->dev,
"algo %s specified, but crypto support for state framework (CONFIG_STATE_CRYPTO) not enabled.\n",
@@ -1590,10 +1594,6 @@ static int state_backend_raw_file_init_digest(struct state *state, struct state_
return -EINVAL;
}
- ret = of_property_read_string(state->root, "algo", &algo);
- if (ret)
- return ret;
-
ret = keystore_get_secret(state->name, &key, &key_len);
if (ret == -ENOENT) /* -ENOENT == does not exist */
return -EPROBE_DEFER;
--
2.6.4
More information about the barebox
mailing list