summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorMelin Tomas <tomas.melin@vaisala.com>2019-06-28 12:08:31 +0000
committerHeiko Schocher <hs@denx.de>2019-07-09 07:02:11 +0200
commit5324e8ef6c3d6b6183b3aadeadeeb7822b4fd68a (patch)
treec97dc451d41d4c8c7c9dc9a207f08a0218b5d03d /drivers/i2c
parent2d1e879c79f922a2d4c18c09c9363b76ce9e5643 (diff)
xilinx_xiic: Fix fill tx fifo loop
Comparison should be against the actual message length, not loop index. len is used for stopping while loop, pos is position in message. stop should be sent when entire message is sent, not when len and pos meet. hs: fixed DOS line endings Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/xilinx_xiic.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/xilinx_xiic.c b/drivers/i2c/xilinx_xiic.c
index 83114ed510..e4ca0ab936 100644
--- a/drivers/i2c/xilinx_xiic.c
+++ b/drivers/i2c/xilinx_xiic.c
@@ -149,7 +149,7 @@ static void xiic_fill_tx_fifo(struct xilinx_xiic_priv *priv,
while (len--) {
u16 data = msg->buf[pos++];
- if (pos == len && nmsgs == 1) {
+ if ((msg->len - pos == 0) && nmsgs == 1) {
/* last message in transfer -> STOP */
data |= XIIC_TX_DYN_STOP_MASK;
}