Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7089f086 authored by Siddartha Mohanadoss's avatar Siddartha Mohanadoss
Browse files

hwmon: qpnp-adc: Fix incorrect threshold calculation



Fix using the correct types when performing integer
arithmetic.

Signed-off-by: default avatarSiddartha Mohanadoss <smohanad@codeaurora.org>
Change-Id: I712a22d3f550efac1d059e1dd3ae933a3de84acd
parent 92b716b2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1233,7 +1233,7 @@ int32_t qpnp_vadc_absolute_rthr(struct qpnp_vadc_chip *chip,
	if (rc < 0)
		return rc;

	low_thr = (((param->low_thr)/chan_prop->offset_gain_denominator
	low_thr = (((param->low_thr)/(int)chan_prop->offset_gain_denominator
					- QPNP_ADC_625_UV) * vbatt_param.dy);
	if (low_thr < 0) {
		sign = 1;
@@ -1246,7 +1246,7 @@ int32_t qpnp_vadc_absolute_rthr(struct qpnp_vadc_chip *chip,
	*low_threshold = low_thr + vbatt_param.adc_gnd;

	sign = 0;
	high_thr = (((param->high_thr)/chan_prop->offset_gain_denominator
	high_thr = (((param->high_thr)/(int)chan_prop->offset_gain_denominator
					- QPNP_ADC_625_UV) * vbatt_param.dy);
	if (high_thr < 0) {
		sign = 1;