archive mirror
 help / color / mirror / Atom feed
From: "Fabio M. De Francesco" <>
To: Suren Baghdasaryan <>
Cc: "Greg Kroah-Hartman" <>,
	"Arve Hjønnevåg" <>,
	"Todd Kjos" <>,
	"Martijn Coenen" <>,
	"Joel Fernandes" <>,
	"Christian Brauner" <>,
	"Hridya Valsaraju" <>,
	LKML <>,
Subject: Re: [PATCH] staging: android: Remove set but unused variable in ashmem.c
Date: Sat, 24 Jul 2021 09:49:35 +0200	[thread overview]
Message-ID: <13453441.4PhDYAFLLM@localhost.localdomain> (raw)
In-Reply-To: <>

On Friday, July 23, 2021 10:14:46 PM CEST Suren Baghdasaryan wrote:
> On Fri, Jul 23, 2021 at 1:05 PM Fabio M. De Francesco
> <> wrote:
> > Remove variable 'inode' tnat is set but unused. Issue detected
> > by building with warning option -Wunused-but-set-variable.
> > 
> > [...]
> > 
> > -               inode = file_inode(vmfile);
> > 
> >                 lockdep_set_class(&inode->i_rwsem, 
> How about its usage in the above lockdep_set_class(&inode->i_rwsem,
> ...) call? 

I'm sorry. I didn't notice that 'inode' is used soon after assignment, just in 
the line that follows it. I was also too confident that rebuilding the driver 
would have triggered an error if it is used somewhere else. I was obviously 

Furthermore, I usually automatically search with grep or other tools for other 
occurrences of a symbol in the function and the file, but this time I must 
have forgotten to do that.

> I'm guessing you are building with CONFIG_LOCKDEP=n.

Actually my .config sets CONFIG_LOCKDEP_SUPPORT=y. Did you refer to this? 
There is no CONFIG_LOCKDEP in the file.
I've just run "make clean && make C=2 -j8 drivers/staging/android/ W=1" one 
more time and it still builds.  How is it possible that the code builds 
correctly with my configuration? 

This is the output (the last two lines) of 'make':

CC      drivers/staging/android/ashmem.o
AR      drivers/staging/android/built-in.

There are no errors or warnings, even with that "lockdep_set_class(&inode-
>i_rwsem, &backing_shmem_inode_class);" left as-is after 'inode' removal. 

I really can't understand what I'm missing.

> Have you tried adding __maybe_unused in inode variable definition to
> get rid of the warning?
Actually, I didn't know that directive that you mention. I'll read the 
documentation and, if and where suited, I'll use it.


> > [...]
> > --
> > 2.32.0

  reply	other threads:[~2021-07-24  7:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 20:05 Fabio M. De Francesco
2021-07-23 20:14 ` Suren Baghdasaryan
2021-07-24  7:49   ` Fabio M. De Francesco [this message]
2021-07-26 13:44     ` Dan Carpenter
2021-07-28 12:00       ` Fabio M. De Francesco
2021-07-24  2:53 ` kernel test robot
2021-07-24  3:14 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13453441.4PhDYAFLLM@localhost.localdomain \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] staging: android: Remove set but unused variable in ashmem.c' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).