]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pinctrl: k210: Fix loop in k210_pc_get_drive()
authorNiklas Cassel <niklas.cassel@wdc.com>
Tue, 1 Mar 2022 10:35:44 +0000 (10:35 +0000)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Tue, 15 Mar 2022 09:43:11 +0000 (17:43 +0800)
The loop exited too early so the k210_pc_drive_strength[0] array element
was never used.

Original Linux patch by Dan Carpenter:
https://lore.kernel.org/linux-gpio/20220209180804.GA18385@kili/

Fixes: 7224d5ccf8e1 ("pinctrl: Add support for Kendryte K210 FPIOA")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
drivers/pinctrl/pinctrl-k210.c

index 63084ae837529fcb044f887e4172527c41e6dfcd..f809149102fb600e49e8c552d241f04b95a2bc05 100644 (file)
@@ -511,7 +511,7 @@ static int k210_pc_get_drive(unsigned max_strength_ua)
 {
        int i;
 
-       for (i = K210_PC_DRIVE_MAX; i; i--)
+       for (i = K210_PC_DRIVE_MAX; i >= 0; i--)
                if (k210_pc_drive_strength[i] < max_strength_ua)
                        return i;