diff options
author | Peter Huewe <peterhuewe@gmx.de> | 2013-03-04 22:17:15 +0100 |
---|---|---|
committer | Kent Yoder <key@linux.vnet.ibm.com> | 2013-04-12 19:17:29 +0200 |
commit | 6aa4ef4dab92fc8d4f0e5ea735ae3fd520af510b (patch) | |
tree | 41649e3734eb73ee10ddda927b4d1afb0b5c17ff /drivers/char | |
parent | tpm/tpm_i2c_infineon.c: Add OF attributes type and name to the of_device_id t... (diff) | |
download | linux-6aa4ef4dab92fc8d4f0e5ea735ae3fd520af510b.tar.xz linux-6aa4ef4dab92fc8d4f0e5ea735ae3fd520af510b.zip |
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.
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/tpm/tpm_i2c_infineon.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c index d83bb8c0217b..37d5dcc10ea7 100644 --- a/drivers/char/tpm/tpm_i2c_infineon.c +++ b/drivers/char/tpm/tpm_i2c_infineon.c @@ -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; |