]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: sx9310: Fix access to variable DT array
authorGwendal Grignou <gwendal@chromium.org>
Fri, 26 Mar 2021 18:46:02 +0000 (11:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 08:52:05 +0000 (10:52 +0200)
commit99f8854ad3dadda15fd46deca57fc9205f888980
tree47ebe5b9400fa174695aa848509a2dcb550237f1
parent0a5cc717d5ae98fa61ec26c1445c495f79073e45
iio: sx9310: Fix access to variable DT array

commit 6f0078ae704d94b1a93e5f3d0a44cf3d8090fa91 upstream.

With the current code, we want to read 4 entries from DT array
"semtech,combined-sensors". If there are less, we silently fail as
of_property_read_u32_array() returns -EOVERFLOW.

First count the number of entries and if between 1 and 4, collect the
content of the array.

Fixes: 5b19ca2c78a0 ("iio: sx9310: Set various settings from DT")
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210326184603.251683-2-gwendal@chromium.org
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/proximity/sx9310.c