From: Jonathan Cameron Date: Fri, 12 Aug 2011 15:55:34 +0000 (+0100) Subject: staging:iio:accel:adis16201 overflow tx buffer. X-Git-Tag: firefly_0821_release~3680^2~4313^2^2~864^2~253 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=70a876c59007ddb166a36c1073f45633bef1513b;p=firefly-linux-kernel-4.4.55.git staging:iio:accel:adis16201 overflow tx buffer. Smatch caught bug. Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/accel/adis16201_ring.c b/drivers/staging/iio/accel/adis16201_ring.c index 66e708ddf8b2..a745d5debc20 100644 --- a/drivers/staging/iio/accel/adis16201_ring.c +++ b/drivers/staging/iio/accel/adis16201_ring.c @@ -38,10 +38,12 @@ static int adis16201_read_ring_data(struct iio_dev *indio_dev, u8 *rx) xfers[i].cs_change = 1; xfers[i].len = 2; xfers[i].delay_usecs = 20; - xfers[i].tx_buf = st->tx + 2 * i; - st->tx[2 * i] = ADIS16201_READ_REG(ADIS16201_SUPPLY_OUT + - 2 * i); - st->tx[2 * i + 1] = 0; + if (i < ADIS16201_OUTPUTS) { + xfers[i].tx_buf = st->tx + 2 * i; + st->tx[2 * i] = ADIS16201_READ_REG(ADIS16201_SUPPLY_OUT + + 2 * i); + st->tx[2 * i + 1] = 0; + } if (i >= 1) xfers[i].rx_buf = rx + 2 * (i - 1); spi_message_add_tail(&xfers[i], &msg);