staging: android: struct should normally be const
PATCH 1/1 staging: android: struct should normally be const
Add const before static struct file_operations for tells the compiler to not let anybody modify it.
--- drivers/staging/android/ashmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ashmem.c +1 -1
@@ -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; +const static struct file_operations vmfile_fops;struct ashmem_area *asma = file->private_data;int ret =0 ;
Signature · 1 line
2.7.4
Greg KH
maintainerSome comments on the patch, but first, please properly set the "From:" text in your email client, it does not show your name :(
Quoted 2 lines · On Fri, Mar 27, 2020 at 02:56:50AM +0300, [email protected] wrote:
Add const before static struct
file_operationsfor tells the compiler to not let anybody modify it.
You have trailing whitespace on your changelog text :(
But, most importantly, what are you trying to do in this patch?
Why would you make this const? Who is telling you to do that?
Quoted 10 lines
Signed-off-by Gokce Kuler <[email protected]>--- drivers/staging/android/ashmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/android/ashmem.c +0
-0
drivers/staging/android/ashmem.c ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr, · line 370
Quoted 5 lines
drivers/staging/android/ashmem.c +1
-1@@ -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; +const static struct file_operations vmfile_fops;
Did you test-build this patch? It breaks the build horribly which is a big hint that this is not a correct change :)
thanks,
greg k-h