Skip to content

Commit

Permalink
fuel_gauge: sbs_gauge: fix uninitialized variable warning
Browse files Browse the repository at this point in the history
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 <daniel.leung@intel.com>
  • Loading branch information
dcpleung authored and nashif committed Aug 23, 2023
1 parent 8023d59 commit 302f065
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/fuel_gauge/sbs_gauge/sbs_gauge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 302f065

Please sign in to comment.