Linux kernel staging patches
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Leonardo Araujo <leonardo.aa88@gmail.com>, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH] Staging : android: Struct file_operations should be const
Date: Sun, 06 Feb 2022 22:32:14 -0800	[thread overview]
Message-ID: <62a6db49ef29745514b0263b9bb39b5a16f90efe.camel@perches.com> (raw)
In-Reply-To: <20220207031711.13644-1-leonardo.aa88@gmail.com>

On Mon, 2022-02-07 at 00:17 -0300, Leonardo Araujo wrote:
> From: "Leonardo Araujo" <leonardo.aa88@gmail.com>
> 
> WARNING: struct file_operations should normally be const

Always compile the files modified by a patch before you send it out.

[]
> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
[]
> @@ -377,7 +377,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;
>  

<apply patch>
$ make allyesconfig
$ make drivers/staging/android/ashmem.o
[...]
  CC      drivers/staging/android/ashmem.o
drivers/staging/android/ashmem.c: In function ‘ashmem_mmap’:
drivers/staging/android/ashmem.c:431:37: error: assignment of read-only variable ‘vmfile_fops’
  431 |                         vmfile_fops = *vmfile->f_op;
      |                                     ^
drivers/staging/android/ashmem.c:432:42: error: assignment of member ‘mmap’ in read-only object
  432 |                         vmfile_fops.mmap = ashmem_vmfile_mmap;
      |                                          ^
drivers/staging/android/ashmem.c:433:55: error: assignment of member ‘get_unmapped_area’ in read-only object
  433 |                         vmfile_fops.get_unmapped_area =
      |                                                       ^
make[3]: *** [scripts/Makefile.build:289: drivers/staging/android/ashmem.o] Error 1
make[2]: *** [scripts/Makefile.build:572: drivers/staging/android] Error 2
make[1]: *** [scripts/Makefile.build:572: drivers/staging] Error 2
make: *** [Makefile:1965: drivers] Error 2




  reply	other threads:[~2022-02-07  6:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07  3:17 [PATCH] Staging : android: Struct file_operations should be const Leonardo Araujo
2022-02-07  6:32 ` Joe Perches [this message]
2022-02-07  8:19 ` kernel test robot
2022-02-07 16:01 ` Al Viro
2022-02-08  9:48   ` Greg KH

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=62a6db49ef29745514b0263b9bb39b5a16f90efe.camel@perches.com \
    --to=joe@perches.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=leonardo.aa88@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox