]> git.baikalelectronics.ru Git - kernel.git/commit
iio: fix iio_format_avail_range() printing for none IIO_VAL_INT
authorFawzi Khaber <fawzi.khaber@tdk.com>
Mon, 18 Jul 2022 13:07:06 +0000 (15:07 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 19 Jul 2022 08:31:27 +0000 (09:31 +0100)
commitc808398e768dffa4ae1f27e7cecfd92868571de2
tree3da490e58bd335973e5ebf5d8f0e30953d3d9de3
parentd49d650ed2d9b710f468036d0d7f17ba6caeeebd
iio: fix iio_format_avail_range() printing for none IIO_VAL_INT

iio_format_avail_range() should print range as follow [min, step, max], so
the function was previously calling iio_format_list() with length = 3,
length variable refers to the array size of values not the number of
elements. In case of non IIO_VAL_INT values each element has integer part
and decimal part. With length = 3 this would cause premature end of loop
and result in printing only one element.

Signed-off-by: Fawzi Khaber <fawzi.khaber@tdk.com>
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Fixes: 58884cd94635 ("iio: core: Consolidate iio_format_avail_{list,range}()")
Link: https://lore.kernel.org/r/20220718130706.32571-1-jmaneyrol@invensense.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-core.c