summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2008-11-13 15:28:21 +0900
committerPaul Mundt <lethal@linux-sh.org>2008-11-13 15:37:07 +0900
commitbff4056c8b868a4311d5ebd6cbbf09a2c10f4551 (patch)
treea6ee2db33682deb761aae97a98a5983116151bc7 /drivers/i2c
parent185aed75570fb4f78ef283dfa26cd9da5fa06a91 (diff)
i2c: fix i2c-sh_mobile rx underrun
Fix receive path underrun in i2c-sh_mobile driver. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-sh_mobile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 640cbb23732..3384a717fec 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -318,7 +318,8 @@ static int sh_mobile_i2c_isr_rx(struct sh_mobile_i2c_data *pd)
} else
data = i2c_op(pd, OP_RX, 0);
- pd->msg->buf[real_pos] = data;
+ if (real_pos >= 0)
+ pd->msg->buf[real_pos] = data;
} while (0);
pd->pos++;