From: Magnus Damm Date: Thu, 13 Nov 2008 06:28:21 +0000 (+0900) Subject: i2c: fix i2c-sh_mobile rx underrun X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bff4056c8b868a4311d5ebd6cbbf09a2c10f4551;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.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 640cbb237328..3384a717fec0 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++;