From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Todd Kjos" <tkjos@android.com>,
"Martijn Coenen" <maco@android.com>,
"Joel Fernandes" <joel@joelfernandes.org>,
"Christian Brauner" <christian@brauner.io>,
"Hridya Valsaraju" <hridya@google.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-staging@lists.linux.dev
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: <CAJuCfpF37KXw2SG37_XoRyhGWc+uueU0NaxcEfU1=FH-rRm+bQ@mail.gmail.com>
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
>
> <fmdefrancesco@gmail.com> 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,
&backing_shmem_inode_class);
>
> 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
wrong.
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.
Thanks,
Fabio
>
> > [...]
> > --
> > 2.32.0
next prev parent reply other threads:[~2021-07-24 7:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-23 20:05 [PATCH] staging: android: Remove set but unused variable in ashmem.c 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 2:53 ` kernel test robot
2021-07-24 3:14 ` 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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* 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 \
--to=fmdefrancesco@gmail.com \
--cc=arve@android.com \
--cc=christian@brauner.io \
--cc=gregkh@linuxfoundation.org \
--cc=hridya@google.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=maco@android.com \
--cc=surenb@google.com \
--cc=tkjos@android.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.