fs/ocfs2/dlmglue: lockdep_keys defined but not used

Message ID 20180704095318.19218-1-anders.roxell@linaro.org
State New
Headers show
Series
  • fs/ocfs2/dlmglue: lockdep_keys defined but not used
Related show

Commit Message

Anders Roxell July 4, 2018, 9:53 a.m.
When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and
we get a warning:
fs/ocfs2/dlmglue.c:99:30: warning: ‘lockdep_keys’ defined but not used
    [-Wunused-variable]
 static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];
                              ^~~~~~~~~~~~
Adding __maybe_unused to the declaration hids the warning.

Fixes: 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

---
 fs/ocfs2/dlmglue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.18.0

Comments

Anders Roxell July 26, 2018, 7:21 a.m. | #1
On Wed, 4 Jul 2018 at 11:53, Anders Roxell <anders.roxell@linaro.org> wrote:
>

> When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and

> we get a warning:

> fs/ocfs2/dlmglue.c:99:30: warning: ‘lockdep_keys’ defined but not used

>     [-Wunused-variable]

>  static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];

>                               ^~~~~~~~~~~~

> Adding __maybe_unused to the declaration hids the warning.

>

> Fixes: 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

> ---

>  fs/ocfs2/dlmglue.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c

> index 040ddb6e7dab..160e0b224367 100644

> --- a/fs/ocfs2/dlmglue.c

> +++ b/fs/ocfs2/dlmglue.c

> @@ -96,7 +96,7 @@ struct ocfs2_unblock_ctl {

>  };

>

>  /* Lockdep class keys */

> -static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];

> +static struct lock_class_key __maybe_unused lockdep_keys[OCFS2_NUM_LOCK_TYPES];

>

>  static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres,

>                                         int new_level);

> --

> 2.18.0

>


Ping.
Geert Uytterhoeven Aug. 23, 2018, 9:07 p.m. | #2
Hi Anders,

On Wed, Jul 4, 2018 at 11:54 AM Anders Roxell <anders.roxell@linaro.org> wrote:
> When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and

> we get a warning:

> fs/ocfs2/dlmglue.c:99:30: warning: ‘lockdep_keys’ defined but not used

>     [-Wunused-variable]

>  static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];

>                               ^~~~~~~~~~~~

> Adding __maybe_unused to the declaration hids the warning.


Thanks for your patcj!

> Fixes: 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")


Fixes: 480bd56485b77c36 ("ocfs2: make several functions and variables
static (and some const)")

Presumably the branch got rebased?

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>


Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>


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
Anders Roxell Aug. 24, 2018, 1:07 p.m. | #3
On Thu, 23 Aug 2018 at 23:07, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>

> Hi Anders,

>

> On Wed, Jul 4, 2018 at 11:54 AM Anders Roxell <anders.roxell@linaro.org> wrote:

> > When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and

> > we get a warning:

> > fs/ocfs2/dlmglue.c:99:30: warning: ‘lockdep_keys’ defined but not used

> >     [-Wunused-variable]

> >  static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];

> >                               ^~~~~~~~~~~~

> > Adding __maybe_unused to the declaration hids the warning.

>

> Thanks for your patcj!

>

> > Fixes: 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")

>

> Fixes: 480bd56485b77c36 ("ocfs2: make several functions and variables

> static (and some const)")


Thanks, thats correct.

>

> Presumably the branch got rebased?


probably.

Mark, Joel, do you want me to send a new patch where I correct the sha
in the "Fixes" part of the changelog or can you fix that?

Cheers,
Anders

>

> > Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

>

> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

>

> 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
Borislav Petkov Oct. 9, 2018, 6:22 p.m. | #4
On Fri, Aug 24, 2018 at 03:07:03PM +0200, Anders Roxell wrote:
> On Thu, 23 Aug 2018 at 23:07, Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> >

> > Hi Anders,

> >

> > On Wed, Jul 4, 2018 at 11:54 AM Anders Roxell <anders.roxell@linaro.org> wrote:

> > > When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and

> > > we get a warning:

> > > fs/ocfs2/dlmglue.c:99:30: warning: ‘lockdep_keys’ defined but not used

> > >     [-Wunused-variable]

> > >  static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];

> > >                               ^~~~~~~~~~~~

> > > Adding __maybe_unused to the declaration hids the warning.

> >

> > Thanks for your patcj!

> >

> > > Fixes: 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")

> >

> > Fixes: 480bd56485b77c36 ("ocfs2: make several functions and variables

> > static (and some const)")

> 

> Thanks, thats correct.

> 

> >

> > Presumably the branch got rebased?

> 

> probably.

> 

> Mark, Joel, do you want me to send a new patch where I correct the sha

> in the "Fixes" part of the changelog or can you fix that?


FWIW, I'm still seeing this in randconfig builds here.

Adding akpm in case no one picks this up.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
Andrew Morton Oct. 9, 2018, 10:40 p.m. | #5
On Tue, 9 Oct 2018 20:22:17 +0200 Borislav Petkov <bp@alien8.de> wrote:

> On Fri, Aug 24, 2018 at 03:07:03PM +0200, Anders Roxell wrote:

> > On Thu, 23 Aug 2018 at 23:07, Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> > >

> > > Hi Anders,

> > >

> > > On Wed, Jul 4, 2018 at 11:54 AM Anders Roxell <anders.roxell@linaro.org> wrote:

> > > > When CONFIG_DEBUG_LOCK_ALLOC isn't enabled lockdep_keys isn't used and

> > > > we get a warning:

> > > > fs/ocfs2/dlmglue.c:99:30: warning: ‘lockdep_keys’ defined but not used

> > > >     [-Wunused-variable]

> > > >  static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];

> > > >                               ^~~~~~~~~~~~

> > > > Adding __maybe_unused to the declaration hids the warning.

> > >

> > > Thanks for your patcj!

> > >

> > > > Fixes: 1cd75cdb8fbb ("ocfs2: make several functions and variables static (and some const)")

> > >

> > > Fixes: 480bd56485b77c36 ("ocfs2: make several functions and variables

> > > static (and some const)")

> > 

> > Thanks, thats correct.

> > 

> > >

> > > Presumably the branch got rebased?

> > 

> > probably.

> > 

> > Mark, Joel, do you want me to send a new patch where I correct the sha

> > in the "Fixes" part of the changelog or can you fix that?

> 

> FWIW, I'm still seeing this in randconfig builds here.

> 

> Adding akpm in case no one picks this up.

> 


https://ozlabs.org/~akpm/mmots/broken-out/ocfs2-fix-a-gcc-compiled-warning.patch
is queued for 4.20-rc1.  I'll see if we can squeeze it into 4.19.

Patch

diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 040ddb6e7dab..160e0b224367 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -96,7 +96,7 @@  struct ocfs2_unblock_ctl {
 };
 
 /* Lockdep class keys */
-static struct lock_class_key lockdep_keys[OCFS2_NUM_LOCK_TYPES];
+static struct lock_class_key __maybe_unused lockdep_keys[OCFS2_NUM_LOCK_TYPES];
 
 static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres,
 					int new_level);