[SeaBIOS] [PATCH 3/6] tpm: use bool as return parameter
Stefan Berger
stefanb at linux.vnet.ibm.com
Wed Jun 10 01:56:30 CEST 2015
Have is_tpm_present and has_working_tpm return bool.
Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
---
src/tcgbios.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/tcgbios.c b/src/tcgbios.c
index 58170d7..6c1a14f 100644
--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -12,6 +12,8 @@
#include "config.h"
+#include <stdbool.h>
+
#include "types.h"
#include "byteorder.h" // cpu_to_*
#include "hw/tpm_drivers.h" // tpm_drivers[]
@@ -101,10 +103,10 @@ static tpm_state_t tpm_state = {
*******************************************************/
-static u32
+static bool
is_tpm_present(void)
{
- u32 rc = 0;
+ bool rc = false;
unsigned int i;
for (i = 0; i < TPM_NUM_DRIVERS; i++) {
@@ -112,7 +114,7 @@ is_tpm_present(void)
if (td->probe() != 0) {
td->init();
tpm_state.tpm_driver_to_use = i;
- rc = 1;
+ rc = true;
break;
}
}
@@ -125,12 +127,12 @@ probe_tpm(void)
{
if (!tpm_state.tpm_probed) {
tpm_state.tpm_probed = 1;
- tpm_state.tpm_found = (is_tpm_present() != 0);
+ tpm_state.tpm_found = (is_tpm_present());
tpm_state.tpm_working = tpm_state.tpm_found;
}
}
-static int
+static bool
has_working_tpm(void)
{
probe_tpm();
@@ -1043,7 +1045,7 @@ tpm_interrupt_handler32(struct bregs *regs)
switch ((enum irq_ids)regs->al) {
case TCG_StatusCheck:
- if (is_tpm_present() == 0) {
+ if (!is_tpm_present()) {
/* no TPM available */
regs->eax = TCG_PC_TPM_NOT_PRESENT;
} else {
--
1.9.3
More information about the SeaBIOS
mailing list