tpm: Add a helper for checking hwrng enabled
authorMario Limonciello <mario.limonciello@amd.com>
Tue, 8 Aug 2023 04:12:29 +0000 (23:12 -0500)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 9 Aug 2023 17:05:15 +0000 (10:05 -0700)
commitcacc6e22932f373a91d7be55a9b992dc77f4c59b
tree809cfcaf78a8c97414268a9d48b3fd28997d1e9d
parent22883973244b1caaa26f9c6171a41ba843c8d4bd
tpm: Add a helper for checking hwrng enabled

The same checks are repeated in three places to decide whether to use
hwrng.  Consolidate these into a helper.

Also this fixes a case that one of them was missing a check in the
cleanup path.

Fixes: 554b841d4703 ("tpm: Disable RNG for all AMD fTPMs")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/tpm/tpm-chip.c