]> www.infradead.org Git - users/dwmw2/linux.git/commit
iio: inkern: make a best effort on offset calculation
authorLiam Beguin <liambeguin@gmail.com>
Sat, 8 Jan 2022 20:53:06 +0000 (15:53 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:39:50 +0000 (14:39 +0200)
commit9f0cd81174579c4ca1f02d9f90bae88b916810e0
treeb62a02798ef7812e30d210ec7da8dd6fa4d3e643
parent19e533452fbebfd053556732073cf94b7ac59127
iio: inkern: make a best effort on offset calculation

commit ca85123354e1a65a22170286387b4791997fe864 upstream.

iio_convert_raw_to_processed_unlocked() assumes the offset is an
integer. Make a best effort to get a valid offset value for fractional
cases without breaking implicit truncations.

Fixes: 48e44ce0f881 ("iio:inkern: Add function to read the processed value")
Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220108205319.2046348-4-liambeguin@gmail.com
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/inkern.c