]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: afe: rescale: use s64 for temporary scale calculations
authorLiam Beguin <liambeguin@gmail.com>
Sat, 8 Jan 2022 20:53:07 +0000 (15:53 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Apr 2022 12:14:38 +0000 (14:14 +0200)
commitb47a8cd4823205d48a01fe70270ec3d9424fe119
treeecac125404015820c893e56ffd5c45e05a47bb1c
parentbc56766e1dd83f12a2778ab4d1ec8d01ca890c06
iio: afe: rescale: use s64 for temporary scale calculations

commit 51593106b608ae4247cc8da928813347da16d025 upstream.

All four scaling coefficients can take signed values.
Make tmp a signed 64-bit integer and switch to div_s64() to preserve
signs during 64-bit divisions.

Fixes: 8b74816b5a9a ("iio: afe: rescale: new driver")
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-5-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/afe/iio-rescale.c