From: Stuart Yoder <stuart.yoder@arm.com>
To: linux-integrity@vger.kernel.org, jarkko@kernel.org,
peterhuewe@gmx.de, jgg@ziepe.ca, sudeep.holla@arm.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] tpm_crb: ffa_tpm: return errors from interface functions if no ffa-crb driver
Date: Mon, 14 Apr 2025 09:52:35 -0500 [thread overview]
Message-ID: <20250414145235.938924-1-stuart.yoder@arm.com> (raw)
If ACPI advertises an FF-A based TPM but the tpm_crb_ffa driver is not
enabled via Kconfig, inline stub versions of the interface functions
are used. These functions incorrectly return 0, which indicates success.
The result is that the tpm_crb probe function continues execution and
eventually detects a timeout at the TPM.
Change the inline functions to return errors, so that probe() sees that
tpm_crb_ffa is not present and aborts the probe.
Signed-off-by: Stuart Yoder <stuart.yoder@arm.com>
---
drivers/char/tpm/tpm_crb_ffa.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/char/tpm/tpm_crb_ffa.h b/drivers/char/tpm/tpm_crb_ffa.h
index 645c41ede10ed..c006403e2f14b 100644
--- a/drivers/char/tpm/tpm_crb_ffa.h
+++ b/drivers/char/tpm/tpm_crb_ffa.h
@@ -14,9 +14,9 @@ int tpm_crb_ffa_init(void);
int tpm_crb_ffa_get_interface_version(u16 *major, u16 *minor);
int tpm_crb_ffa_start(int request_type, int locality);
#else
-static inline int tpm_crb_ffa_init(void) { return 0; }
-static inline int tpm_crb_ffa_get_interface_version(u16 *major, u16 *minor) { return 0; }
-static inline int tpm_crb_ffa_start(int request_type, int locality) { return 0; }
+static inline int tpm_crb_ffa_init(void) { return -ENODEV; }
+static inline int tpm_crb_ffa_get_interface_version(u16 *major, u16 *minor) { return -ENODEV; }
+static inline int tpm_crb_ffa_start(int request_type, int locality) { return -ENODEV; }
#endif
#define CRB_FFA_START_TYPE_COMMAND 0
--
2.34.1
next reply other threads:[~2025-04-14 14:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-14 14:52 Stuart Yoder [this message]
2025-04-14 15:18 ` [PATCH] tpm_crb: ffa_tpm: return errors from interface functions if no ffa-crb driver Sudeep Holla
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=20250414145235.938924-1-stuart.yoder@arm.com \
--to=stuart.yoder@arm.com \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
--cc=sudeep.holla@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.