Skip to contentSkip to conversation

tpm/tpm_i2c_infineon: Add small comment about return value of __i2c_transfer

PATCH New Peter Huewe 1 participant 1 message Mar 4, 2013 TPM device driver

lore
Share & tools
lore

Peter Huewe

author maintainer
#0 lore raw

PATCH 1/1 tpm/tpm_i2c_infineon: Add small comment about return value of __i2c_transfer

Kent Yoder indicated that the code might be a bit clearer with a comment here, so this patch adds a small explanation of the code.

---
 drivers/char/tpm/tpm_i2c_infineon.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/char/tpm/tpm_i2c_infineon.c +9 -0
index d83bb8c..37d5dcc 100644
@@ -162,6 +162,10 @@ out:
 	/* take care of 'guard time' */
 	usleep_range(SLEEP_DURATION_LOW, SLEEP_DURATION_HI);
 
+	/* __i2c_transfer returns the number of successfully transferred
+	 * messages.
+	 * So rc should be greater than 0 here otherwise we have an error.
+	 */
 	if (rc <= 0)
 		return -EIO;
 
@@ -208,6 +212,11 @@ static int iic_tpm_write_generic(u8 addr, u8 *buffer, size_t len,
 	i2c_unlock_adapter(tpm_dev.client->adapter);
 	/* take care of 'guard time' */
 	usleep_range(SLEEP_DURATION_LOW, SLEEP_DURATION_HI);
+
+	/* __i2c_transfer returns the number of successfully transferred
+	 * messages.
+	 * So rc should be greater than 0 here otherwise we have an error.
+	 */
 	if (rc <= 0)
 		return -EIO;
 
Signature · 1 line
1.7.12.4