From: Magnus Damm Date: Thu, 13 Nov 2008 06:28:21 +0000 (+0900) Subject: i2c: fix i2c-sh_mobile rx underrun X-Git-Tag: v2.6.28-rc5~3^2~5 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=bff4056c8b868a4311d5ebd6cbbf09a2c10f4551;p=linux-2.6-omap-h63xx.git i2c: fix i2c-sh_mobile rx underrun Fix receive path underrun in i2c-sh_mobile driver. Signed-off-by: Magnus Damm Signed-off-by: Paul Mundt --- 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++;