Skip to content
Commit 7e23a189 authored by Zach Thomas's avatar Zach Thomas Committed by Benjamin Cabé
Browse files

drivers: sensor: scd4x: fix int overflow on val2 for temp and hum



The scd4x_channel_get function converts raw word values to
struct sensor_value's per the datasheet. The calculation for val2 of a
struct sensor_value `val->val2 = ((tmp_val % 0xFFFF) * 1000000) / 0xFFFF;`
can overflow the max of int32_t, resulting in an incorrect
sensor_value.
Fix it by changing the type of tmp_val to int64_t.

Signed-off-by: default avatarZach Thomas <zach.thomas1.zt@gmail.com>
parent 097fcb8f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment