* [PATCH] tpm_crb: ffa_tpm: return errors from interface functions if no ffa-crb driver
@ 2025-04-14 14:52 Stuart Yoder
2025-04-14 15:18 ` Sudeep Holla
0 siblings, 1 reply; 2+ messages in thread
From: Stuart Yoder @ 2025-04-14 14:52 UTC (permalink / raw)
To: linux-integrity, jarkko, peterhuewe, jgg, sudeep.holla; +Cc: linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] tpm_crb: ffa_tpm: return errors from interface functions if no ffa-crb driver
2025-04-14 14:52 [PATCH] tpm_crb: ffa_tpm: return errors from interface functions if no ffa-crb driver Stuart Yoder
@ 2025-04-14 15:18 ` Sudeep Holla
0 siblings, 0 replies; 2+ messages in thread
From: Sudeep Holla @ 2025-04-14 15:18 UTC (permalink / raw)
To: Stuart Yoder
Cc: linux-integrity, jarkko, Sudeep Holla, peterhuewe, jgg,
linux-kernel
On Mon, Apr 14, 2025 at 09:52:35AM -0500, Stuart Yoder wrote:
> 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.
>
LGTM,
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-14 15:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 14:52 [PATCH] tpm_crb: ffa_tpm: return errors from interface functions if no ffa-crb driver Stuart Yoder
2025-04-14 15:18 ` Sudeep Holla
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.