extcon: madera: Fix skipping of ranges < external resistor
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Sat, 3 Mar 2018 17:30:34 +0000 (17:30 +0000)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:29 +0000 (20:22 +0300)
The loop for skipping external ranges should start at the first
valid range. It was starting at 0 which on cs47l15 had the effect
of changing hpdet_init_range to 0.

Change-Id: If4783b66b661dceca28aaa5617f6494af7898c5f
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
drivers/extcon/extcon-madera.c

index 2bbb91f8bb9971e88792f9598ff071c332a11152..4709ea1855e0dffbedcd3c17a2afcb99cb0c67ec 100644 (file)
@@ -3312,7 +3312,7 @@ static int madera_extcon_probe(struct platform_device *pdev)
        }
 
        /* Skip any HPDET ranges less than the external resistance */
-       for (i = 0; i < info->num_hpdet_ranges; ++i) {
+       for (i = info->hpdet_init_range; i < info->num_hpdet_ranges; ++i) {
                if (madera_ohm_to_hohm(info->hpdet_ranges[i].max) >=
                    pdata->hpdet_ext_res_x100) {
                        info->hpdet_init_range = i;