2022-05-03 02:46:30

by kernel test robot

[permalink] [raw]
Subject: [PATCH] ARM: dove: fix returnvar.cocci warnings

From: kernel test robot <[email protected]>

arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161


Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

Reported-by: kernel test robot <[email protected]>
Signed-off-by: kernel test robot <[email protected]>
---

tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 9f9b9a2972eb8dcaad09d826c5c6d7488eaca3e6
commit: 09f6b27d5ddd9ad0ec096d1b0f8decdacc70f0f8 [1066/8035] ARM: dove: multiplatform support
:::::: branch date: 15 hours ago
:::::: commit date: 4 weeks ago

arch/arm/mach-omap2/dma.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -79,8 +79,6 @@ static const struct omap_dma_reg reg_map

static unsigned configure_dma_errata(void)
{
- unsigned errata = 0;
-
/*
* Errata applicable for OMAP2430ES1.0 and all omap2420
*
@@ -158,7 +156,7 @@ static unsigned configure_dma_errata(voi
if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
SET_DMA_ERRATA(DMA_ROMCODE_BUG);

- return errata;
+ return 0;
}

static const struct dma_slave_map omap24xx_sdma_dt_map[] = {


2022-05-03 08:09:39

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

* Arnd Bergmann <[email protected]> [220503 07:18]:
> On Tue, May 3, 2022 at 4:45 AM kernel test robot <[email protected]> wrote:
> >
> > From: kernel test robot <[email protected]>
> >
> > arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
> >
> >
> > Remove unneeded variable used to store return value.
> >
> > Generated by: scripts/coccinelle/misc/returnvar.cocci
> >
> > Reported-by: kernel test robot <[email protected]>
> > Signed-off-by: kernel test robot <[email protected]>
>
> I checked the patch, and unfortunately it is wrong, the current code
> needs to stay.
> The problem is the SET_DMA_ERRATA() macro that accesses the
> local 'errata' variable.

Yeah this one keeps popping up. Maybe we can make SET_DMA_ERRATA
into a function or have it at least change it to set the errata
value.

Regards,

Tony

2022-05-03 08:37:36

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

On Tue, May 3, 2022 at 4:45 AM kernel test robot <[email protected]> wrote:
>
> From: kernel test robot <[email protected]>
>
> arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
>
>
> Remove unneeded variable used to store return value.
>
> Generated by: scripts/coccinelle/misc/returnvar.cocci
>
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: kernel test robot <[email protected]>

I checked the patch, and unfortunately it is wrong, the current code
needs to stay.
The problem is the SET_DMA_ERRATA() macro that accesses the
local 'errata' variable.

Arnd

2022-05-03 11:13:15

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

* Arnd Bergmann <[email protected]> [220503 08:12]:
> On Tue, May 3, 2022 at 9:30 AM Tony Lindgren <[email protected]> wrote:
> > * Arnd Bergmann <[email protected]> [220503 07:18]:
> > > On Tue, May 3, 2022 at 4:45 AM kernel test robot <[email protected]> wrote:
> > > >
> > > > From: kernel test robot <[email protected]>
> > > >
> > > > arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
> > > >
> > > >
> > > > Remove unneeded variable used to store return value.
> > > >
> > > > Generated by: scripts/coccinelle/misc/returnvar.cocci
> > > >
> > > > Reported-by: kernel test robot <[email protected]>
> > > > Signed-off-by: kernel test robot <[email protected]>
> > >
> > > I checked the patch, and unfortunately it is wrong, the current code
> > > needs to stay.
> > > The problem is the SET_DMA_ERRATA() macro that accesses the
> > > local 'errata' variable.
> >
> > Yeah this one keeps popping up. Maybe we can make SET_DMA_ERRATA
> > into a function or have it at least change it to set the errata
> > value.
>
> I would just remove the macro and open-code the assignment, which
> I think makes it more readable to both people and tools.

Yeah agree after looking at the macro :)

Regards,

Tony

2022-05-03 11:20:56

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

On Tue, May 3, 2022 at 9:30 AM Tony Lindgren <[email protected]> wrote:
> * Arnd Bergmann <[email protected]> [220503 07:18]:
> > On Tue, May 3, 2022 at 4:45 AM kernel test robot <[email protected]> wrote:
> > >
> > > From: kernel test robot <[email protected]>
> > >
> > > arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
> > >
> > >
> > > Remove unneeded variable used to store return value.
> > >
> > > Generated by: scripts/coccinelle/misc/returnvar.cocci
> > >
> > > Reported-by: kernel test robot <[email protected]>
> > > Signed-off-by: kernel test robot <[email protected]>
> >
> > I checked the patch, and unfortunately it is wrong, the current code
> > needs to stay.
> > The problem is the SET_DMA_ERRATA() macro that accesses the
> > local 'errata' variable.
>
> Yeah this one keeps popping up. Maybe we can make SET_DMA_ERRATA
> into a function or have it at least change it to set the errata
> value.

I would just remove the macro and open-code the assignment, which
I think makes it more readable to both people and tools.

Arnd

2022-05-05 17:33:08

by Russell King (Oracle)

[permalink] [raw]
Subject: Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

On Tue, May 03, 2022 at 10:45:32AM +0800, kernel test robot wrote:
> From: kernel test robot <[email protected]>
>
> arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
>
>
> Remove unneeded variable used to store return value.
>
> Generated by: scripts/coccinelle/misc/returnvar.cocci
>
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: kernel test robot <[email protected]>

NAK. The analysis is wrong.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

2022-05-06 09:21:28

by Li, Philip

[permalink] [raw]
Subject: Re: [kbuild-all] Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

On Thu, May 05, 2022 at 03:08:40PM +0100, Russell King (Oracle) wrote:
> On Tue, May 03, 2022 at 10:45:32AM +0800, kernel test robot wrote:
> > From: kernel test robot <[email protected]>
> >
> > arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
> >
> >
> > Remove unneeded variable used to store return value.
> >
> > Generated by: scripts/coccinelle/misc/returnvar.cocci
> >
> > Reported-by: kernel test robot <[email protected]>
> > Signed-off-by: kernel test robot <[email protected]>
>
> NAK. The analysis is wrong.

sorry about the false patch, we will improve this.

>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
> _______________________________________________
> kbuild-all mailing list -- [email protected]
> To unsubscribe send an email to [email protected]

2022-05-06 15:11:57

by Li, Philip

[permalink] [raw]
Subject: Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

On Thu, May 05, 2022 at 09:31:37AM -0700, Dave Hansen wrote:
> On 5/3/22 00:21, Arnd Bergmann wrote:
> > On Tue, May 3, 2022 at 4:45 AM kernel test robot <[email protected]> wrote:
> >> From: kernel test robot <[email protected]>
> >>
> >> arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
> >>
> >> Remove unneeded variable used to store return value.
> >>
> >> Generated by: scripts/coccinelle/misc/returnvar.cocci
> >>
> >> Reported-by: kernel test robot <[email protected]>
> >> Signed-off-by: kernel test robot <[email protected]>
> > I checked the patch, and unfortunately it is wrong, the current code
> > needs to stay.
> > The problem is the SET_DMA_ERRATA() macro that accesses the
> > local 'errata' variable.
>
> 0day folks, do we have humans looking over these before they're going
> out to the list? If not, can we add some? If so, can the humans get a
> little more discerning? ;)

Sorry all for the bad patch. So far, we pick up several cocci warnings that
we have confidence based on early result analysis and feedback, for these
warnings, 0day sends out patch automatically.

Thanks for the suggestion Dave, We will change current process to be more
conservative and to avoid false patch by adding human analysis.

Thanks

2022-05-06 19:15:18

by Dave Hansen

[permalink] [raw]
Subject: Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

On 5/3/22 00:21, Arnd Bergmann wrote:
> On Tue, May 3, 2022 at 4:45 AM kernel test robot <[email protected]> wrote:
>> From: kernel test robot <[email protected]>
>>
>> arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
>>
>> Remove unneeded variable used to store return value.
>>
>> Generated by: scripts/coccinelle/misc/returnvar.cocci
>>
>> Reported-by: kernel test robot <[email protected]>
>> Signed-off-by: kernel test robot <[email protected]>
> I checked the patch, and unfortunately it is wrong, the current code
> needs to stay.
> The problem is the SET_DMA_ERRATA() macro that accesses the
> local 'errata' variable.

0day folks, do we have humans looking over these before they're going
out to the list? If not, can we add some? If so, can the humans get a
little more discerning? ;)

2022-05-07 06:44:39

by Li, Philip

[permalink] [raw]
Subject: Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

On Fri, May 06, 2022 at 09:17:44AM +0200, Arnd Bergmann wrote:
> On Fri, May 6, 2022 at 3:09 AM Philip Li <[email protected]> wrote:
> > On Thu, May 05, 2022 at 09:31:37AM -0700, Dave Hansen wrote:
> > > On 5/3/22 00:21, Arnd Bergmann wrote:
> > > > On Tue, May 3, 2022 at 4:45 AM kernel test robot <[email protected]> wrote:
> > > >> From: kernel test robot <[email protected]>
> > > >>
> > > >> arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
> > > >>
> > > >> Remove unneeded variable used to store return value.
> > > >>
> > > >> Generated by: scripts/coccinelle/misc/returnvar.cocci
> > > >>
> > > >> Reported-by: kernel test robot <[email protected]>
> > > >> Signed-off-by: kernel test robot <[email protected]>
> > > > I checked the patch, and unfortunately it is wrong, the current code
> > > > needs to stay.
> > > > The problem is the SET_DMA_ERRATA() macro that accesses the
> > > > local 'errata' variable.
> > >
> > > 0day folks, do we have humans looking over these before they're going
> > > out to the list? If not, can we add some? If so, can the humans get a
> > > little more discerning? ;)
> >
> > Sorry all for the bad patch. So far, we pick up several cocci warnings that
> > we have confidence based on early result analysis and feedback, for these
> > warnings, 0day sends out patch automatically.
> >
> > Thanks for the suggestion Dave, We will change current process to be more
> > conservative and to avoid false patch by adding human analysis.
>
> For the returnvar.cocci false-positives, I wonder if it's possible to find them
> using another coccinelle helper that detects badly formed macros which
> access variables out of scope. I can't think of how this would be expressed,
> but maybe someone has an idea.
>
> Something else went wrong in this particular patch, and I can't explain
> how this happened: the subject line contains the name of the wrong platform,
> "dove" rather than "omap2". My guess is that this was human error copying
> the subject line from another patch, but if this came from a script, you
> may want to check how this gets generated.

Thanks Arnd, we will investigate this to fix our side issue. And thanks for
taking time to check the detail, as mentioned in other reply, we will not
send out patch unless it is carefully reviewed/acked by members of 0day.

>
> Arnd

2022-05-07 22:34:03

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

On Fri, 6 May 2022 at 03:12, Philip Li <[email protected]> wrote:
>
> On Thu, May 05, 2022 at 09:31:37AM -0700, Dave Hansen wrote:
> > On 5/3/22 00:21, Arnd Bergmann wrote:
> > > On Tue, May 3, 2022 at 4:45 AM kernel test robot <[email protected]> wrote:
> > >> From: kernel test robot <[email protected]>
> > >>
> > >> arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
> > >>
> > >> Remove unneeded variable used to store return value.
> > >>
> > >> Generated by: scripts/coccinelle/misc/returnvar.cocci
> > >>
> > >> Reported-by: kernel test robot <[email protected]>
> > >> Signed-off-by: kernel test robot <[email protected]>
> > > I checked the patch, and unfortunately it is wrong, the current code
> > > needs to stay.
> > > The problem is the SET_DMA_ERRATA() macro that accesses the
> > > local 'errata' variable.
> >
> > 0day folks, do we have humans looking over these before they're going
> > out to the list? If not, can we add some? If so, can the humans get a
> > little more discerning? ;)
>
> Sorry all for the bad patch. So far, we pick up several cocci warnings that
> we have confidence based on early result analysis and feedback, for these
> warnings, 0day sends out patch automatically.
>

Could you please add a special header or something to such emails so I
can filter them out? I am strongly opposed to such automatic spambot
patch generation, as it wastes valuable reviewer bandwidth to save the
bot operator some time, but it think it should be the other way
around.

We expect contributors to carefully prepare their patch submissions
before sending them to the list, and automatically generated patches
simply don't mesh with that. The fact that you use a bot does not mean
you can ignore these rules.

2022-05-08 13:10:33

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

On Fri, May 6, 2022 at 3:09 AM Philip Li <[email protected]> wrote:
> On Thu, May 05, 2022 at 09:31:37AM -0700, Dave Hansen wrote:
> > On 5/3/22 00:21, Arnd Bergmann wrote:
> > > On Tue, May 3, 2022 at 4:45 AM kernel test robot <[email protected]> wrote:
> > >> From: kernel test robot <[email protected]>
> > >>
> > >> arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
> > >>
> > >> Remove unneeded variable used to store return value.
> > >>
> > >> Generated by: scripts/coccinelle/misc/returnvar.cocci
> > >>
> > >> Reported-by: kernel test robot <[email protected]>
> > >> Signed-off-by: kernel test robot <[email protected]>
> > > I checked the patch, and unfortunately it is wrong, the current code
> > > needs to stay.
> > > The problem is the SET_DMA_ERRATA() macro that accesses the
> > > local 'errata' variable.
> >
> > 0day folks, do we have humans looking over these before they're going
> > out to the list? If not, can we add some? If so, can the humans get a
> > little more discerning? ;)
>
> Sorry all for the bad patch. So far, we pick up several cocci warnings that
> we have confidence based on early result analysis and feedback, for these
> warnings, 0day sends out patch automatically.
>
> Thanks for the suggestion Dave, We will change current process to be more
> conservative and to avoid false patch by adding human analysis.

For the returnvar.cocci false-positives, I wonder if it's possible to find them
using another coccinelle helper that detects badly formed macros which
access variables out of scope. I can't think of how this would be expressed,
but maybe someone has an idea.

Something else went wrong in this particular patch, and I can't explain
how this happened: the subject line contains the name of the wrong platform,
"dove" rather than "omap2". My guess is that this was human error copying
the subject line from another patch, but if this came from a script, you
may want to check how this gets generated.

Arnd

2022-05-09 07:42:59

by Li, Philip

[permalink] [raw]
Subject: Re: [PATCH] ARM: dove: fix returnvar.cocci warnings

On Fri, May 06, 2022 at 09:24:26AM +0200, Ard Biesheuvel wrote:
> On Fri, 6 May 2022 at 03:12, Philip Li <[email protected]> wrote:
> >
> > On Thu, May 05, 2022 at 09:31:37AM -0700, Dave Hansen wrote:
> > > On 5/3/22 00:21, Arnd Bergmann wrote:
> > > > On Tue, May 3, 2022 at 4:45 AM kernel test robot <[email protected]> wrote:
> > > >> From: kernel test robot <[email protected]>
> > > >>
> > > >> arch/arm/mach-omap2/dma.c:82:10-16: Unneeded variable: "errata". Return "0" on line 161
> > > >>
> > > >> Remove unneeded variable used to store return value.
> > > >>
> > > >> Generated by: scripts/coccinelle/misc/returnvar.cocci
> > > >>
> > > >> Reported-by: kernel test robot <[email protected]>
> > > >> Signed-off-by: kernel test robot <[email protected]>
> > > > I checked the patch, and unfortunately it is wrong, the current code
> > > > needs to stay.
> > > > The problem is the SET_DMA_ERRATA() macro that accesses the
> > > > local 'errata' variable.
> > >
> > > 0day folks, do we have humans looking over these before they're going
> > > out to the list? If not, can we add some? If so, can the humans get a
> > > little more discerning? ;)
> >
> > Sorry all for the bad patch. So far, we pick up several cocci warnings that
> > we have confidence based on early result analysis and feedback, for these
> > warnings, 0day sends out patch automatically.
> >
>
> Could you please add a special header or something to such emails so I
> can filter them out? I am strongly opposed to such automatic spambot
> patch generation, as it wastes valuable reviewer bandwidth to save the
> bot operator some time, but it think it should be the other way
> around.

Sorry for the trouble, we will stop sending the patch automatically and
only send out patch after human confirmed/reviewed.

>
> We expect contributors to carefully prepare their patch submissions
> before sending them to the list, and automatically generated patches
> simply don't mesh with that. The fact that you use a bot does not mean
> you can ignore these rules.

Got it, we will improve this to follow the right way to send out patches.

Thanks