From: Yunseong Kim <yunseong.kim@est.tech>
To: Tom Lendacky <thomas.lendacky@amd.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Mario Limonciello <mario.limonciello@amd.com>,
John Allen <john.allen@amd.com>,
"David S. Miller" <davem@davemloft.net>
Cc: Yunseong Kim <ysk@kzalloc.com>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Yunseong Kim <yunseong.kim@est.tech>
Subject: [PATCH v2] crypto: ccp: Fix incorrect return type for psp_get_capability()
Date: Sun, 26 Apr 2026 23:25:40 +0200 [thread overview]
Message-ID: <20260426-master-v2-1-dac9d1d99cfa@est.tech> (raw)
psp_get_capability() is declared as returning an 'unsigned int'. However,
it returns -ENODEV on failure when it cannot access the device registers
(i.e., when ioread32 returns 0xffffffff).
Since -ENODEV is a negative value, returning it from a function declared as
'unsigned int' results in an implicit cast to a large positive integer.
This prevents the caller psp_dev_init() from correctly detecting the
error condition, leading to improper error handling.
Signed-off-by: Yunseong Kim <yunseong.kim@est.tech>
---
Changes in v2:
- Address feedback from Tom Lendacky.
---
drivers/crypto/ccp/psp-dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index 5c7f7e02a7d8..664cd51bbf0d 100644
--- a/drivers/crypto/ccp/psp-dev.c
+++ b/drivers/crypto/ccp/psp-dev.c
@@ -141,7 +141,7 @@ static irqreturn_t psp_irq_handler(int irq, void *data)
return IRQ_HANDLED;
}
-static unsigned int psp_get_capability(struct psp_device *psp)
+static int psp_get_capability(struct psp_device *psp)
{
unsigned int val = ioread32(psp->io_regs + psp->vdata->feature_reg);
---
base-commit: 7080e32d3f09d8688c4a87d81bdcc71f7f606b16
change-id: 20260426-master-eba8d68042ab
Best regards,
--
Yunseong Kim <yunseong.kim@est.tech>
reply other threads:[~2026-04-26 21:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260426-master-v2-1-dac9d1d99cfa@est.tech \
--to=yunseong.kim@est.tech \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=john.allen@amd.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=thomas.lendacky@amd.com \
--cc=ysk@kzalloc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox