]> 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, 8 Apr 2022 11:57:15 +0000 (13:57 +0200)
commit45be763c90cb6adf7d5920bb62bf72060046a8e6
tree562ee456abbd212d8ca05ff50a45b2487b7f86f5
parent8d46cb07e8301c1b8d11c7ae8975a4f33c3ffff8
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