drivers: input: Fix uninitialized closest_mv variable warning

Building with GCC 9.4.0 gives the following warning/error:

  error: closest_mv may be used uninitialized in this function

This commit fixes it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2024-03-07 13:13:57 +01:00 committed by Fabio Baltieri
parent 25830e3828
commit 35502592a7

View file

@ -70,7 +70,7 @@ static inline int32_t adc_keys_read(const struct device *dev)
static inline void adc_keys_process(const struct device *dev)
{
const struct adc_keys_config *cfg = dev->config;
int32_t sample_mv, closest_mv;
int32_t sample_mv, closest_mv = 0;
uint32_t diff, closest_diff = UINT32_MAX;
const struct adc_keys_code_config *code_cfg;
struct adc_keys_key_state *key_state;