lkml.org 
[lkml]   [2021]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH] staging: android: Remove set but unused variable in ashmem.c
    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.
    >
    > Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
    > ---
    > drivers/staging/android/ashmem.c | 2 --
    > 1 file changed, 2 deletions(-)
    >
    > diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
    > index ddbde3f8430e..606e988d3f63 100644
    > --- a/drivers/staging/android/ashmem.c
    > +++ b/drivers/staging/android/ashmem.c
    > @@ -406,7 +406,6 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
    > if (!asma->file) {
    > char *name = ASHMEM_NAME_DEF;
    > struct file *vmfile;
    > - struct inode *inode;
    >
    > if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
    > name = asma->name;
    > @@ -418,7 +417,6 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
    > goto out;
    > }
    > vmfile->f_mode |= FMODE_LSEEK;
    > - 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 guessing you are building with CONFIG_LOCKDEP=n.
    Have you tried adding __maybe_unused in inode variable definition to
    get rid of the warning?


    > asma->file = vmfile;
    > /*
    > --
    > 2.32.0
    >

    \
     
     \ /
      Last update: 2021-07-23 22:16    [W:4.456 / U:1.204 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site