[coreboot-gerrit] New patch to review for coreboot: drivers/i2c/tpm: Fix error handling for tis structure not initialized

Duncan Laurie (dlaurie@chromium.org) gerrit at coreboot.org
Fri Sep 2 23:47:56 CEST 2016


Duncan Laurie (dlaurie at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16416

-gerrit

commit bb64542b047ccfb87d039f4fdb014ca80ba00980
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Fri Sep 2 14:45:53 2016 -0700

    drivers/i2c/tpm: Fix error handling for tis structure not initialized
    
    If the TPM completely fails to respond then the vendor structure may not
    have assigned handlers yet, so catch that case and return error so the
    boot can continue to recovery mode instead of asserting over and over.
    
    Change-Id: If3a11567df89bc73b4d4878bf89d877974044f34
    Signed-off-by: Duncan Laurie <dlaurie at chromium.org>
---
 src/drivers/i2c/tpm/tis.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/drivers/i2c/tpm/tis.c b/src/drivers/i2c/tpm/tis.c
index c6173b4..ce0de89 100644
--- a/src/drivers/i2c/tpm/tis.c
+++ b/src/drivers/i2c/tpm/tis.c
@@ -114,6 +114,9 @@ static ssize_t tpm_transmit(const uint8_t *buf, size_t bufsiz)
 	memcpy(&ordinal, buf + TPM_CMD_ORDINAL_BYTE, sizeof(ordinal));
 	ordinal = be32_to_cpu(ordinal);
 
+	if (!chip->vendor.send || !chip->vendor.status || !chip->vendor.cancel)
+		return -1;
+
 	if (count == 0) {
 		printk(BIOS_DEBUG, "tpm_transmit: no data\n");
 		return -1;



More information about the coreboot-gerrit mailing list