]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.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)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Mon, 24 May 2021 23:46:12 +0000 (17:46 -0600)
commit37a48e86306139c18d6c2d932220baa26c07c675
tree4471e2c2c4a2f7b38c80f05df0770bdd6c2999b2
parent9604643da75ded6a7e2534cc2a9f3379eb97ac24
iio: sx9310: Fix access to variable DT array

BugLink: https://bugs.launchpad.net/bugs/1929455
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/iio/proximity/sx9310.c