]> Gentwo Git Trees - linux/.git/commitdiff
power: supply: rt9467: Prevent using uninitialized local variable in rt9467_set_value...
authorMurad Masimov <m.masimov@mt-integration.ru>
Thu, 9 Oct 2025 14:53:08 +0000 (17:53 +0300)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Mon, 3 Nov 2025 00:01:57 +0000 (01:01 +0100)
There is a typo in rt9467_set_value_from_ranges() that can cause leaving local
variable sel with an undefined value which is then used in regmap_field_write().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 6f7f70e3a8dd ("power: supply: rt9467: Add Richtek RT9467 charger driver")
Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru>
Link: https://patch.msgid.link/20251009145308.1830893-1-m.masimov@mt-integration.ru
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/rt9467-charger.c

index b4917514bd701cbec405db5cf36d622912d6be79..44c26fb37a775fc25f50df97e277ba1059d2fc12 100644 (file)
@@ -376,7 +376,7 @@ static int rt9467_set_value_from_ranges(struct rt9467_chg_data *data,
        if (rsel == RT9467_RANGE_VMIVR) {
                ret = linear_range_get_selector_high(range, value, &sel, &found);
                if (ret)
-                       value = range->max_sel;
+                       sel = range->max_sel;
        } else {
                linear_range_get_selector_within(range, value, &sel);
        }