diff mbox series

gpio: gpiolib: remove shadowed variable

Message ID 20210105105914.13172-1-wsa+renesas@sang-engineering.com
State New
Headers show
Series gpio: gpiolib: remove shadowed variable | expand

Commit Message

Wolfram Sang Jan. 5, 2021, 10:59 a.m. UTC
After refactoring, we had two variables for the same thing. Remove the
second declaration, one is enough here. Found by cppcheck.

drivers/gpio/gpiolib.c:2551:17: warning: Local variable 'ret' shadows outer variable [shadowVariable]

Fixes: d377f56f34f5 ("gpio: gpiolib: Normalize return code variable name")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven Jan. 5, 2021, 11:14 a.m. UTC | #1
On Tue, Jan 5, 2021 at 12:00 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> After refactoring, we had two variables for the same thing. Remove the
> second declaration, one is enough here. Found by cppcheck.
>
> drivers/gpio/gpiolib.c:2551:17: warning: Local variable 'ret' shadows outer variable [shadowVariable]
>
> Fixes: d377f56f34f5 ("gpio: gpiolib: Normalize return code variable name")
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert
Wolfram Sang Jan. 27, 2021, 10:39 a.m. UTC | #2
On Tue, Jan 05, 2021 at 12:14:34PM +0100, Geert Uytterhoeven wrote:
> On Tue, Jan 5, 2021 at 12:00 PM Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
> > After refactoring, we had two variables for the same thing. Remove the
> > second declaration, one is enough here. Found by cppcheck.
> >
> > drivers/gpio/gpiolib.c:2551:17: warning: Local variable 'ret' shadows outer variable [shadowVariable]
> >
> > Fixes: d377f56f34f5 ("gpio: gpiolib: Normalize return code variable name")
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Ccing Linus & Bartosz
Bartosz Golaszewski Feb. 1, 2021, 8:58 a.m. UTC | #3
On Wed, Jan 27, 2021 at 11:39 AM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> On Tue, Jan 05, 2021 at 12:14:34PM +0100, Geert Uytterhoeven wrote:
> > On Tue, Jan 5, 2021 at 12:00 PM Wolfram Sang
> > <wsa+renesas@sang-engineering.com> wrote:
> > > After refactoring, we had two variables for the same thing. Remove the
> > > second declaration, one is enough here. Found by cppcheck.
> > >
> > > drivers/gpio/gpiolib.c:2551:17: warning: Local variable 'ret' shadows outer variable [shadowVariable]
> > >
> > > Fixes: d377f56f34f5 ("gpio: gpiolib: Normalize return code variable name")
> > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> >
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Ccing Linus & Bartosz
>

For some reason this is not on patchwork and I also don't have it in
my inbox, can you resend, please?

Bart
Geert Uytterhoeven Feb. 1, 2021, 9:04 a.m. UTC | #4
Hi Bartosz,

On Mon, Feb 1, 2021 at 9:59 AM Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
> On Wed, Jan 27, 2021 at 11:39 AM Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
> > On Tue, Jan 05, 2021 at 12:14:34PM +0100, Geert Uytterhoeven wrote:
> > > On Tue, Jan 5, 2021 at 12:00 PM Wolfram Sang
> > > <wsa+renesas@sang-engineering.com> wrote:
> > > > After refactoring, we had two variables for the same thing. Remove the
> > > > second declaration, one is enough here. Found by cppcheck.
> > > >
> > > > drivers/gpio/gpiolib.c:2551:17: warning: Local variable 'ret' shadows outer variable [shadowVariable]
> > > >
> > > > Fixes: d377f56f34f5 ("gpio: gpiolib: Normalize return code variable name")
> > > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > >
> > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >
> > Ccing Linus & Bartosz
> >
>
> For some reason this is not on patchwork and I also don't have it in
> my inbox, can you resend, please?

https://lore.kernel.org/linux-gpio/20210105105914.13172-1-wsa+renesas@sang-engineering.com/

Gr{oetje,eeting}s,

                        Geert
Bartosz Golaszewski Feb. 1, 2021, 12:25 p.m. UTC | #5
On Mon, Feb 1, 2021 at 10:04 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Bartosz,
>
> On Mon, Feb 1, 2021 at 9:59 AM Bartosz Golaszewski
> <bgolaszewski@baylibre.com> wrote:
> > On Wed, Jan 27, 2021 at 11:39 AM Wolfram Sang
> > <wsa+renesas@sang-engineering.com> wrote:
> > > On Tue, Jan 05, 2021 at 12:14:34PM +0100, Geert Uytterhoeven wrote:
> > > > On Tue, Jan 5, 2021 at 12:00 PM Wolfram Sang
> > > > <wsa+renesas@sang-engineering.com> wrote:
> > > > > After refactoring, we had two variables for the same thing. Remove the
> > > > > second declaration, one is enough here. Found by cppcheck.
> > > > >
> > > > > drivers/gpio/gpiolib.c:2551:17: warning: Local variable 'ret' shadows outer variable [shadowVariable]
> > > > >
> > > > > Fixes: d377f56f34f5 ("gpio: gpiolib: Normalize return code variable name")
> > > > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > > >
> > > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > >
> > > Ccing Linus & Bartosz
> > >
> >
> > For some reason this is not on patchwork and I also don't have it in
> > my inbox, can you resend, please?
>
> https://lore.kernel.org/linux-gpio/20210105105914.13172-1-wsa+renesas@sang-engineering.com/
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

Thanks, now applied. Please make sure to Cc Linus and I next time.

Bartosz
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 611d6ea82d75..c354cc6ed826 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2548,7 +2548,7 @@  int gpiod_get_array_value_complex(bool raw, bool can_sleep,
 		struct gpio_chip *gc = desc_array[i]->gdev->chip;
 		unsigned long fastpath[2 * BITS_TO_LONGS(FASTPATH_NGPIO)];
 		unsigned long *mask, *bits;
-		int first, j, ret;
+		int first, j;
 
 		if (likely(gc->ngpio <= FASTPATH_NGPIO)) {
 			mask = fastpath;