diff mbox series

[2/9,linux-next] fanotify: fanotify_encode_fid(): variable init

Message ID 20200511175934.214881-1-fabf@skynet.be (mailing list archive)
State New, archived
Headers show
Series fs/notify: cleanup | expand

Commit Message

Fabian Frederick May 11, 2020, 5:59 p.m. UTC
Initialize variables at declaration.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/notify/fanotify/fanotify.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Amir Goldstein May 11, 2020, 9:36 p.m. UTC | #1
On Mon, May 11, 2020 at 8:59 PM Fabian Frederick <fabf@skynet.be> wrote:
>
> Initialize variables at declaration.
>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Hi Fabian,

Thank you for the patch.
It is not wrong, but it does not bring that much benefit either IMO.
It does however come with a cost, because it going to have a minor
conflict with one of the patches I posted.

This is why patches should be done for a good reason.

Thanks,
Amir.

> ---
>  fs/notify/fanotify/fanotify.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
> index 95480d3dcff7..5c6f29d2d8f9 100644
> --- a/fs/notify/fanotify/fanotify.c
> +++ b/fs/notify/fanotify/fanotify.c
> @@ -277,16 +277,15 @@ static u32 fanotify_group_event_mask(struct fsnotify_group *group,
>  static void fanotify_encode_fh(struct fanotify_fh *fh, struct inode *inode,
>                                gfp_t gfp)
>  {
> -       int dwords, type, bytes = 0;
> +       int dwords = 0, bytes = 0;
> +       int err = -ENOENT;
> +       int type;
>         char *ext_buf = NULL;
>         void *buf = fh->buf;
> -       int err;
>
>         if (!inode)
>                 goto out;
>
> -       dwords = 0;
> -       err = -ENOENT;
>         type = exportfs_encode_inode_fh(inode, NULL, &dwords, NULL);
>         if (!dwords)
>                 goto out_err;
> --
> 2.26.2
>
diff mbox series

Patch

diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 95480d3dcff7..5c6f29d2d8f9 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -277,16 +277,15 @@  static u32 fanotify_group_event_mask(struct fsnotify_group *group,
 static void fanotify_encode_fh(struct fanotify_fh *fh, struct inode *inode,
 			       gfp_t gfp)
 {
-	int dwords, type, bytes = 0;
+	int dwords = 0, bytes = 0;
+	int err = -ENOENT;
+	int type;
 	char *ext_buf = NULL;
 	void *buf = fh->buf;
-	int err;
 
 	if (!inode)
 		goto out;
 
-	dwords = 0;
-	err = -ENOENT;
 	type = exportfs_encode_inode_fh(inode, NULL, &dwords, NULL);
 	if (!dwords)
 		goto out_err;