tpm_tis_i2c_get_burstcount returns a size_t but also returns -EBUSY if the TPM is surrently busy. As size_t is an unsigned type simply testing for < 0 will not work so change the test for being equal to -EBUSY which will work. Also remove the trivial comments.
This issue was found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodb...@linaro.org> --- drivers/tpm/tpm_tis_infineon.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/tpm/tpm_tis_infineon.c b/drivers/tpm/tpm_tis_infineon.c index e2f6238cbc7..180bcf4f938 100644 --- a/drivers/tpm/tpm_tis_infineon.c +++ b/drivers/tpm/tpm_tis_infineon.c @@ -353,8 +353,7 @@ static int tpm_tis_i2c_recv_data(struct udevice *dev, u8 *buf, size_t count) while (size < count) { burstcnt = tpm_tis_i2c_get_burstcount(dev); - /* burstcount < 0 -> tpm is busy */ - if (burstcnt < 0) + if (burstcnt == -EBUSY) return burstcnt; /* Limit received data to max left */ @@ -449,8 +448,7 @@ static int tpm_tis_i2c_send(struct udevice *dev, const u8 *buf, size_t len) burstcnt = tpm_tis_i2c_get_burstcount(dev); - /* burstcount < 0 -> tpm is busy */ - if (burstcnt < 0) + if (burstcnt == -EBUSY) return burstcnt; while (count < len) { --- base-commit: 7807ed921314cd7af83fd88162d0b8c6fb20a9ca change-id: 20250813-tpm_tis_infineon-62014a7e6158 Best regards, -- Andrew Goodbody <andrew.goodb...@linaro.org>