From 35502592a7c702954697660f390b46e4912f8c56 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 7 Mar 2024 13:13:57 +0100 Subject: [PATCH] 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 --- drivers/input/input_adc_keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/input_adc_keys.c b/drivers/input/input_adc_keys.c index 2e24ffd097..d37d79bf09 100644 --- a/drivers/input/input_adc_keys.c +++ b/drivers/input/input_adc_keys.c @@ -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;