[PATCH] pinctrl: fix loop in k210_pinconf_get_drive()
Damien Le Moal
damien.lemoal at opensource.wdc.com
Wed Feb 9 15:32:11 PST 2022
On 2/10/22 03:08, Dan Carpenter wrote:
> The loop exited too early so the k210_pinconf_drive_strength[0] array
> element was never used.
>
> Fixes: d4c34d09ab03 ("pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver")
> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.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 49e32684dbb2..e3d03f2de7ef 100644
> --- a/drivers/pinctrl/pinctrl-k210.c
> +++ b/drivers/pinctrl/pinctrl-k210.c
> @@ -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;
> }
Reviewed-by: Damien Le Moal <damien.lemoal at opensource.wdc.com>
--
Damien Le Moal
Western Digital Research
More information about the linux-riscv
mailing list