Re: [PATCH] staging: android: Remove set but unused variable in ashmem.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 23, 2021 at 1:05 PM Fabio M. De Francesco
<fmdefrancesco@xxxxxxxxx> 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@xxxxxxxxx>
> ---
>  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
>




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux