From a32b7973d65021486a6ae63d06a575d700eb1f91 Mon Sep 17 00:00:00 2001 From: Richard Lyu Date: Thu, 10 Sep 2026 10:44:31 +0800 Subject: [PATCH] tpm: Remove ineffective wmb() from tpm_pm_resume() The comment above the wmb() in tpm_pm_resume() states that the barrier guarantees TPM_CHIP_FLAG_SUSPENDED is written last, so that hwrng does not activate before the chip has been fully resumed. It cannot do so: it is placed after the store that clears the flag, and therefore does not order the preceding resume work before that store. It also has nothing to pair with, as tpm_try_get_ops() contains no matching read barrier. Drop the barrier along with the comment rather than leave a no-op behind. Should such ordering turn out to be needed, it would require paired barriers or locking. Link: https://lore.kernel.org/all/a62fc816-259a-4d28-a265-e425bc17ed50@gmail.com/ Signed-off-by: Richard Lyu Reviewed-by: Jarkko Sakkinen Link: https://lore.kernel.org/r/20260910024430.40418-1-richard.lyu@suse.com Signed-off-by: Jarkko Sakkinen --- drivers/char/tpm/tpm-interface.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 382a02ab5ee7..e0385b16616b 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -498,12 +498,6 @@ int tpm_pm_resume(struct device *dev) chip->flags &= ~TPM_CHIP_FLAG_SUSPENDED; - /* - * Guarantee that SUSPENDED is written last, so that hwrng does not - * activate before the chip has been fully resumed. - */ - wmb(); - return 0; } EXPORT_SYMBOL_GPL(tpm_pm_resume);