From 302f06534e1b7eb3ba55c36e36fb6c818ce63b9d Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 22 Aug 2023 15:06:25 -0700 Subject: [PATCH] fuel_gauge: sbs_gauge: fix uninitialized variable warning The return variable rc in sbs_gauge_do_battery_cutoff() needs to be initialized, or else it would return random value if the for loop is never entered. Signed-off-by: Daniel Leung --- drivers/fuel_gauge/sbs_gauge/sbs_gauge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c b/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c index b934c434961537..e136900187db32 100644 --- a/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c +++ b/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c @@ -179,7 +179,7 @@ static int sbs_gauge_get_prop(const struct device *dev, struct fuel_gauge_get_pr static int sbs_gauge_do_battery_cutoff(const struct device *dev) { - int rc; + int rc = -ENOTSUP; const struct sbs_gauge_config *cfg = dev->config; if (cfg->cutoff_cfg == NULL) {