summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAndrew Goodbody <[email protected]>2025-08-13 11:40:05 +0100
committerIlias Apalodimas <[email protected]>2025-08-25 13:04:21 +0300
commit73b23838c44b152deef68b7c22d923f0ca7a563f (patch)
tree54ac31f8312ec0ce8bce925a059bf9012e447e0e /drivers
parent83b1c7fd7119ae654aba70b2451b519035b5403d (diff)
tpm: tis_infineon: Cannot test unsigned for being negative
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 <[email protected]> Acked-by: Ilias Apalodimas <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tpm/tpm_tis_infineon.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/tpm/tpm_tis_infineon.c b/drivers/tpm/tpm_tis_infineon.c
index de6566fdb9e..30f23f8610a 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) {