[PATCH] staging: android: ashmem.c: Cleanup

Greg KH gregkh at linuxfoundation.org
Sun Jun 14 06:25:01 UTC 2020


On Sun, Jun 14, 2020 at 11:40:42AM +0700, Dio Putra wrote:
> Okay, my fault here. Changing the function a little bit didn't help unfortunately.
> 
> $ cd ~/git/linux/
> $ make CC=clang W=1 M=drivers/staging/android
>   CC      drivers/staging/android/ashmem.o
> drivers/staging/android/ashmem.c:418:16: error: cannot assign to variable 'vmfile_fops' with const-qualified type 'const struct file_operations'
>                         vmfile_fops = *vmfile->f_op;
>                         ~~~~~~~~~~~ ^
> drivers/staging/android/ashmem.c:370:31: note: variable 'vmfile_fops' declared const here
>         const struct file_operations vmfile_fops;
>         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
> drivers/staging/android/ashmem.c:419:21: error: cannot assign to variable 'vmfile_fops' with const-qualified type 'const struct file_operations'
>                         vmfile_fops.mmap = ashmem_vmfile_mmap;
>                         ~~~~~~~~~~~~~~~~ ^
> drivers/staging/android/ashmem.c:370:31: note: variable 'vmfile_fops' declared const here
>         const struct file_operations vmfile_fops;
>         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
> drivers/staging/android/ashmem.c:420:34: error: cannot assign to variable 'vmfile_fops' with const-qualified type 'const struct file_operations'
>                         vmfile_fops.get_unmapped_area =
>                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
> drivers/staging/android/ashmem.c:370:31: note: variable 'vmfile_fops' declared const here
>         const struct file_operations vmfile_fops;
>         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
> 3 errors generated.
> make[1]: *** [scripts/Makefile.build:267: drivers/staging/android/ashmem.o] Error 1
> make: *** [Makefile:1735: drivers/staging/android] Error 2
> $ 
> 
> On 6/14/20 12:37 AM, Dio Putra wrote:
> > Minor cleanup to make file_operations const once again.
> > 
> > Signed-off-by: Dio Putra <dioput12 at gmail.com>
> > ---
> >  drivers/staging/android/ashmem.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > base-commit: aa5af974127d317071d6225a0f3678c5f520e7ce
> > diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> > index 8044510d8ec6..fbb6ac9ba1ab 100644
> > --- a/drivers/staging/android/ashmem.c
> > +++ b/drivers/staging/android/ashmem.c
> > @@ -367,7 +367,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr,
> >  
> >  static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
> >  {
> > -	static struct file_operations vmfile_fops;
> > +	static const struct file_operations vmfile_fops;
> >  	struct ashmem_area *asma = file->private_data;
> >  	int ret = 0;
> >  

Always test-build your patches before you send them out please...

thanks,

greg k-h


More information about the devel mailing list