iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels()

The > here should be >= or we go beyond the end for the array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Dan Carpenter 2016-04-29 12:03:31 +03:00 committed by Jonathan Cameron
parent c25d3f37be
commit 04bf02175f

View File

@ -525,7 +525,7 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st)
device_for_each_child_node(st->dev, child) {
ret = fwnode_property_read_u32(child, "reg", &reg);
if (ret || reg > ARRAY_SIZE(st->channel_modes))
if (ret || reg >= ARRAY_SIZE(st->channel_modes))
continue;
ret = fwnode_property_read_u32(child, "adi,mode", &tmp);