linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: actions: Fix uninitialized error in owl_pin_config_set()
@ 2018-06-08 10:05 Geert Uytterhoeven
  2018-06-08 10:22 ` Manivannan Sadhasivam
  2018-06-14  8:35 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2018-06-08 10:05 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Andreas Färber, Linus Walleij
  Cc: Arnd Bergmann, linux-arm-kernel, linux-gpio, linux-kernel,
	Geert Uytterhoeven

With gcc 4.1.2:

    drivers/pinctrl/actions/pinctrl-owl.c: In function ‘owl_pin_config_set’:
    drivers/pinctrl/actions/pinctrl-owl.c:336: warning: ‘ret’ may be used uninitialized in this function

Indeed, if num_configs is zero, the uninitialized value will be returned
as an error code.

Fix this by preinitializing it to zero.

Fixes: 2242ddfbf4d699b5 ("pinctrl: actions: Add Actions S900 pinctrl driver")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/pinctrl/actions/pinctrl-owl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/actions/pinctrl-owl.c b/drivers/pinctrl/actions/pinctrl-owl.c
index 76243caa08c630c0..b5c880b50bb371f5 100644
--- a/drivers/pinctrl/actions/pinctrl-owl.c
+++ b/drivers/pinctrl/actions/pinctrl-owl.c
@@ -333,7 +333,7 @@ static int owl_pin_config_set(struct pinctrl_dev *pctrldev,
 	unsigned long flags;
 	unsigned int param;
 	u32 reg, bit, width, arg;
-	int ret, i;
+	int ret = 0, i;
 
 	info = &pctrl->soc->padinfo[pin];
 
-- 
2.7.4

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

* Re: [PATCH] pinctrl: actions: Fix uninitialized error in owl_pin_config_set()
  2018-06-08 10:05 [PATCH] pinctrl: actions: Fix uninitialized error in owl_pin_config_set() Geert Uytterhoeven
@ 2018-06-08 10:22 ` Manivannan Sadhasivam
  2018-06-14  8:35 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2018-06-08 10:22 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andreas Färber, Linus Walleij, Arnd Bergmann,
	linux-arm-kernel, linux-gpio, linux-kernel

On Fri, Jun 08, 2018 at 12:05:47PM +0200, Geert Uytterhoeven wrote:
> With gcc 4.1.2:
> 
>     drivers/pinctrl/actions/pinctrl-owl.c: In function ‘owl_pin_config_set’:
>     drivers/pinctrl/actions/pinctrl-owl.c:336: warning: ‘ret’ may be used uninitialized in this function
> 
> Indeed, if num_configs is zero, the uninitialized value will be returned
> as an error code.
> 
> Fix this by preinitializing it to zero.
> 
> Fixes: 2242ddfbf4d699b5 ("pinctrl: actions: Add Actions S900 pinctrl driver")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> 

Thanks,
Mani
> ---
>  drivers/pinctrl/actions/pinctrl-owl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/actions/pinctrl-owl.c b/drivers/pinctrl/actions/pinctrl-owl.c
> index 76243caa08c630c0..b5c880b50bb371f5 100644
> --- a/drivers/pinctrl/actions/pinctrl-owl.c
> +++ b/drivers/pinctrl/actions/pinctrl-owl.c
> @@ -333,7 +333,7 @@ static int owl_pin_config_set(struct pinctrl_dev *pctrldev,
>  	unsigned long flags;
>  	unsigned int param;
>  	u32 reg, bit, width, arg;
> -	int ret, i;
> +	int ret = 0, i;
>  
>  	info = &pctrl->soc->padinfo[pin];
>  
> -- 
> 2.7.4
> 

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

* Re: [PATCH] pinctrl: actions: Fix uninitialized error in owl_pin_config_set()
  2018-06-08 10:05 [PATCH] pinctrl: actions: Fix uninitialized error in owl_pin_config_set() Geert Uytterhoeven
  2018-06-08 10:22 ` Manivannan Sadhasivam
@ 2018-06-14  8:35 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2018-06-14  8:35 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Manivannan Sadhasivam, Andreas Färber, Arnd Bergmann,
	Linux ARM, open list:GPIO SUBSYSTEM, linux-kernel

On Fri, Jun 8, 2018 at 12:05 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:

> With gcc 4.1.2:
>
>     drivers/pinctrl/actions/pinctrl-owl.c: In function ‘owl_pin_config_set’:
>     drivers/pinctrl/actions/pinctrl-owl.c:336: warning: ‘ret’ may be used uninitialized in this function
>
> Indeed, if num_configs is zero, the uninitialized value will be returned
> as an error code.
>
> Fix this by preinitializing it to zero.
>
> Fixes: 2242ddfbf4d699b5 ("pinctrl: actions: Add Actions S900 pinctrl driver")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Patch applied with Manivannan's ACK.

Yours,
Linus Walleij

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

end of thread, other threads:[~2018-06-14  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08 10:05 [PATCH] pinctrl: actions: Fix uninitialized error in owl_pin_config_set() Geert Uytterhoeven
2018-06-08 10:22 ` Manivannan Sadhasivam
2018-06-14  8:35 ` 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).