summaryrefslogtreecommitdiff
path: root/src/soc/amd/common/block
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2024-10-22 23:06:34 +0200
committerFelix Held <felix-coreboot@felixheld.de>2024-10-28 14:24:32 +0000
commit555551c98856c7a43ae9ab78bba11a2d5058fd81 (patch)
tree2ce43b05d4761ab104d51201c7141d193268f8db /src/soc/amd/common/block
parent33314a09466d6ca98c2fae34a5b4e593a5eb0c04 (diff)
soc/amd/common/block/psp: fix logic bug in psp_get_* functions
The functions psp_get_ftpm_capabilties, psp_get_hsti_state, and psp_get_psp_capabilities which were added in commit 5e7ab1a23346 ("soc/amd/common/psp: add helper functions to retrieve capability bits") have a bug in the 'cmd_status' error handling logic. In case of an error, 'cmd_status' is non-zero, while the check somehow expected the opposite. Fix the bug by returning an error if 'cmd_status' is non-zero. Change-Id: Iafcd185ec4a8a4c0e463b0ac5bac3ef78a0af305 Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/84836 Reviewed-by: Ana Carolina Cabral Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Diffstat (limited to 'src/soc/amd/common/block')
-rw-r--r--src/soc/amd/common/block/psp/psp.c4
-rw-r--r--src/soc/amd/common/block/psp/psp_gen2.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/soc/amd/common/block/psp/psp.c b/src/soc/amd/common/block/psp/psp.c
index 008052b729..9ad04e1ce6 100644
--- a/src/soc/amd/common/block/psp/psp.c
+++ b/src/soc/amd/common/block/psp/psp.c
@@ -71,7 +71,7 @@ enum cb_err psp_get_ftpm_capabilties(uint32_t *capabilities)
/* buffer's status shouldn't change but report it if it does */
psp_print_cmd_status(cmd_status, &buffer.header);
- if (!cmd_status)
+ if (cmd_status)
return CB_ERR;
*capabilities = read32(&buffer.capabilities);
@@ -94,7 +94,7 @@ enum cb_err psp_get_hsti_state(uint32_t *state)
/* buffer's status shouldn't change but report it if it does */
psp_print_cmd_status(cmd_status, &buffer.header);
- if (!cmd_status)
+ if (cmd_status)
return CB_ERR;
*state = read32(&buffer.state);
diff --git a/src/soc/amd/common/block/psp/psp_gen2.c b/src/soc/amd/common/block/psp/psp_gen2.c
index 2113b5725b..21c1f2a735 100644
--- a/src/soc/amd/common/block/psp/psp_gen2.c
+++ b/src/soc/amd/common/block/psp/psp_gen2.c
@@ -193,7 +193,7 @@ enum cb_err psp_get_psp_capabilities(uint32_t *capabilities)
/* buffer's status shouldn't change but report it if it does */
psp_print_cmd_status(cmd_status, &buffer.header);
- if (!cmd_status)
+ if (cmd_status)
return CB_ERR;
*capabilities = read32(&buffer.capabilities);