[PATCH 6/7] pinctrl: k210: Fix loop in k210_pc_get_drive()

Sean Anderson seanga2 at gmail.com
Fri Feb 25 06:15:31 CET 2022


On 2/15/22 11:16 AM, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel at wdc.com>
> 
> 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 at wdc.com>
> ---
>   drivers/pinctrl/pinctrl-k210.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c
> index 63084ae837..f809149102 100644
> --- a/drivers/pinctrl/pinctrl-k210.c
> +++ b/drivers/pinctrl/pinctrl-k210.c
> @@ -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;
>   
> 

Reviewed-by: Sean Anderson <seanga2 at gmail.com>


More information about the U-Boot mailing list