Skip to content

Commit da934ef

Browse files
tobluxjic23
authored andcommitted
iio: adc: pac1934: Fix clamped value in pac1934_reg_snapshot
The local variable 'curr_energy' was never clamped to PAC_193X_MIN_POWER_ACC or PAC_193X_MAX_POWER_ACC because the return value of clamp() was not used. Fix this by assigning the clamped value back to 'curr_energy'. Cc: stable@vger.kernel.org Fixes: 0fb528c ("iio: adc: adding support for PAC193x") Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 92452b1 commit da934ef

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/iio/adc/pac1934.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,9 +665,9 @@ static int pac1934_reg_snapshot(struct pac1934_chip_info *info,
665665
/* add the power_acc field */
666666
curr_energy += inc;
667667

668-
clamp(curr_energy, PAC_193X_MIN_POWER_ACC, PAC_193X_MAX_POWER_ACC);
669-
670-
reg_data->energy_sec_acc[cnt] = curr_energy;
668+
reg_data->energy_sec_acc[cnt] = clamp(curr_energy,
669+
PAC_193X_MIN_POWER_ACC,
670+
PAC_193X_MAX_POWER_ACC);
671671
}
672672

673673
offset_reg_data_p += PAC1934_VPOWER_ACC_REG_LEN;

0 commit comments

Comments
 (0)