mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] crypto: ccp: Avoid discarding errors in psp_send_platform_access_msg()
@ 2024-02-07 21:54 Mario Limonciello
  2024-02-07 21:54 ` [PATCH 2/2] crypto: ccp: Update return values for some unit tests Mario Limonciello
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mario Limonciello @ 2024-02-07 21:54 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Mario Limonciello, Tom Lendacky, John Allen,
	open list:AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - DB...,
	open list, Tim Van Patten

When the PSP_CMDRESP_STS field has an error set, the details of the
error are in `req->header->status`, and the caller will want to look
at them. But if there is no error set then caller may want to check
`req->header->status` separately.

Stop discarding these errors.

Reported-by: Tim Van Patten <timvp@google.com>
Fixes: 7ccc4f4e2e50 ("crypto: ccp - Add support for an interface for platform features")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/crypto/ccp/platform-access.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c
index 94367bc49e35..792ae8d5b11a 100644
--- a/drivers/crypto/ccp/platform-access.c
+++ b/drivers/crypto/ccp/platform-access.c
@@ -120,7 +120,8 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg msg,
 
 	/* Store the status in request header for caller to investigate */
 	cmd_reg = ioread32(cmd);
-	req->header.status = FIELD_GET(PSP_CMDRESP_STS, cmd_reg);
+	if (FIELD_GET(PSP_CMDRESP_STS, cmd_reg))
+		req->header.status = FIELD_GET(PSP_CMDRESP_STS, cmd_reg);
 	if (req->header.status) {
 		ret = -EIO;
 		goto unlock;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-09 19:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 21:54 [PATCH 1/2] crypto: ccp: Avoid discarding errors in psp_send_platform_access_msg() Mario Limonciello
2024-02-07 21:54 ` [PATCH 2/2] crypto: ccp: Update return values for some unit tests Mario Limonciello
2024-02-08 17:24 ` [PATCH 1/2] crypto: ccp: Avoid discarding errors in psp_send_platform_access_msg() Tim Van Patten
2024-02-09 19:05 ` Tom Lendacky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®