[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <YcIpAKV7Cmi0o7PU@debian-BULLSEYE-live-builder-AMD64>
Date: Wed, 22 Dec 2021 00:20:32 +0500
From: Muhammad Usama Anjum <usama.anjum@...labora.com>
To: Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>,
Mihail Chindris <mihail.chindris@...log.com>,
"open list:IIO SUBSYSTEM AND DRIVERS" <linux-iio@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Cc: usama.anjum@...labora.com, kernel@...labora.com,
kernel-janitors@...r.kernel.org
Subject: [PATCH] drivers:iio:dac make expression evaluation 64-bit
Two 32-bit values are being evaluated using 32-bit arithmetic and then
passed to s64 type. It is wrong. Expression should be evaluated using
64-bit arithmetic and then passed.
Fixes: 8f2b54824b ("drivers:iio:dac: Add AD3552R driver support")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@...labora.com>
---
drivers/iio/dac/ad3552r.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/dac/ad3552r.c b/drivers/iio/dac/ad3552r.c
index 97f13c0b9631..b03d3c7cd4c4 100644
--- a/drivers/iio/dac/ad3552r.c
+++ b/drivers/iio/dac/ad3552r.c
@@ -770,7 +770,7 @@ static void ad3552r_calc_gain_and_offset(struct ad3552r_desc *dac, s32 ch)
dac->ch_data[ch].scale_dec = DIV_ROUND_CLOSEST((s64)rem * 1000000,
65536);
- dac->ch_data[ch].offset_int = div_s64_rem(v_min * 65536, span, &rem);
+ dac->ch_data[ch].offset_int = div_s64_rem(v_min * 65536L, span, &rem);
tmp = (s64)rem * 1000000;
dac->ch_data[ch].offset_dec = div_s64(tmp, span);
}
--
2.30.2
Powered by blists - more mailing lists