Skip to content

Commit acec676

Browse files
committed
drivers: sensor: tsic_xx6: fix implicit sign extension
This commit explicitly type-casts data_bits to uint64_t in order to fix implicit sign extension warning Signed-off-by: Jilay Pandya <[email protected]>
1 parent c50777a commit acec676

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/sensor/tsic_xx6/tsic_xx6.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ static void tsic_xx6_get_value(const struct tsic_xx6_config *config, struct tsic
161161
int64_t tmp;
162162

163163
/* Apply the datasheet formula scaled to micro celcius */
164-
tmp = data_bits * (config->higher_temperature_limit - config->lower_temperature_limit);
164+
tmp = (int64_t)data_bits *
165+
(config->higher_temperature_limit - config->lower_temperature_limit);
165166
tmp = tmp * 1000000 / (BIT(config->data_bits) - 1);
166167
tmp += (int64_t)config->lower_temperature_limit * 1000000;
167168

0 commit comments

Comments
 (0)