drivers: fuel_gauge: Fix incorrect variable in bq27xx chem_id switch

The bq27xx driver incorrectly uses the 'val' variable in a switch()
statement that should operate on 'chem_id'. This leads to incorrect
behavior for fuel gauges such as the BQ27427, where the chemical ID
determines how properties are interpreted.

This commit replaces 'switch(val)' with 'switch(chem_id)' to ensure
proper handling of fuel gauge behavior across supported devices.

Signed-off-by: Oleksii Shcherbyna <oleksii.shcherbyna@droid-technologies.com>
This commit is contained in:
Oleksii Shcherbyna 2025-04-30 12:00:14 +03:00 committed by Benjamin Cabé
parent 710e2fd243
commit 35608e295d

View File

@ -363,7 +363,7 @@ static int bq274xx_ensure_chemistry(const struct device *dev)
uint16_t cmd;
switch (val) {
switch (chem_id) {
case BQ27427_CHEM_ID_A:
cmd = BQ27427_CTRL_CHEM_A;
break;