linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: fix loop in k210_pinconf_get_drive()
@ 2022-02-09 18:08 Dan Carpenter
  2022-02-09 18:13 ` Sean Anderson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-02-09 18:08 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Linus Walleij, Sean Anderson, Palmer Dabbelt, linux-riscv,
	linux-gpio, kernel-janitors

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@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;
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: fix loop in k210_pinconf_get_drive()
  2022-02-09 18:08 [PATCH] pinctrl: fix loop in k210_pinconf_get_drive() Dan Carpenter
@ 2022-02-09 18:13 ` Sean Anderson
  2022-02-09 23:32 ` Damien Le Moal
  2022-02-11  1:19 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Sean Anderson @ 2022-02-09 18:13 UTC (permalink / raw)
  To: Dan Carpenter, Damien Le Moal
  Cc: Linus Walleij, Palmer Dabbelt, linux-riscv, linux-gpio, kernel-janitors

On 2/9/22 1:08 PM, 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@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: Sean Anderson <seanga2@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: fix loop in k210_pinconf_get_drive()
  2022-02-09 18:08 [PATCH] pinctrl: fix loop in k210_pinconf_get_drive() Dan Carpenter
  2022-02-09 18:13 ` Sean Anderson
@ 2022-02-09 23:32 ` Damien Le Moal
  2022-02-11  1:19 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2022-02-09 23:32 UTC (permalink / raw)
  To: Dan Carpenter, Damien Le Moal
  Cc: Linus Walleij, Sean Anderson, Palmer Dabbelt, linux-riscv,
	linux-gpio, kernel-janitors

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@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@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: fix loop in k210_pinconf_get_drive()
  2022-02-09 18:08 [PATCH] pinctrl: fix loop in k210_pinconf_get_drive() Dan Carpenter
  2022-02-09 18:13 ` Sean Anderson
  2022-02-09 23:32 ` Damien Le Moal
@ 2022-02-11  1:19 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2022-02-11  1:19 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Damien Le Moal, Sean Anderson, Palmer Dabbelt, linux-riscv,
	linux-gpio, kernel-janitors

On Wed, Feb 9, 2022 at 7:08 PM Dan Carpenter <dan.carpenter@oracle.com> 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@oracle.com>

Patch applied for fixes.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-11  1:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 18:08 [PATCH] pinctrl: fix loop in k210_pinconf_get_drive() Dan Carpenter
2022-02-09 18:13 ` Sean Anderson
2022-02-09 23:32 ` Damien Le Moal
2022-02-11  1:19 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).