Skip to content

Commit

Permalink
pinctrl: fix loop in k210_pinconf_get_drive()
Browse files Browse the repository at this point in the history
The loop exited too early so the k210_pinconf_drive_strength[0] array
element was never used.

Fixes: d4c34d0 ("pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20220209180804.GA18385@kili
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Dan Carpenter authored and linusw committed Feb 11, 2022
1 parent dfd42fa commit ba2ab85
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pinctrl/pinctrl-k210.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ static int k210_pinconf_get_drive(unsigned int max_strength_ua)
{
int i;

for (i = K210_PC_DRIVE_MAX; i; i--) {
for (i = K210_PC_DRIVE_MAX; i >= 0; i--) {
if (k210_pinconf_drive_strength[i] <= max_strength_ua)
return i;
}
Expand Down

0 comments on commit ba2ab85

Please sign in to comment.