Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932572Ab3CDVRD (ORCPT ); Mon, 4 Mar 2013 16:17:03 -0500 Received: from mout.gmx.net ([212.227.17.21]:53410 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932434Ab3CDVRA (ORCPT ); Mon, 4 Mar 2013 16:17:00 -0500 X-Authenticated: #12255092 X-Provags-ID: V01U2FsdGVkX1/kl8o3MU/kf2nQu3BKNSYqVu+9TgIaXO0mlbm2PL 4AJE8x4y5U6CVx From: Peter Huewe To: Kent Yoder Cc: tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Peter Huewe , Kent Yoder Subject: [PATCH] tpm/tpm_i2c_infineon: Add small comment about return value of __i2c_transfer Date: Mon, 4 Mar 2013 22:17:15 +0100 Message-Id: <1362431835-21443-1-git-send-email-peterhuewe@gmx.de> X-Mailer: git-send-email 1.7.12.4 X-Y-GMX-Trusted: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1488 Lines: 44 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. CC: Kent Yoder Signed-off-by: Peter Huewe --- drivers/char/tpm/tpm_i2c_infineon.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c index d83bb8c..37d5dcc 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; -- 1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/