Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 2/9 linux-next] fanotify: fanotify_encode_fid(): variable init
@ 2020-05-11 17:59 Fabian Frederick
  2020-05-11 21:36 ` Amir Goldstein
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2020-05-11 17:59 UTC (permalink / raw)
  To: jack, amir73il; +Cc: linux-fsdevel, Fabian Frederick

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(-)

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/9 linux-next] fanotify: fanotify_encode_fid(): variable init
  2020-05-11 17:59 [PATCH 2/9 linux-next] fanotify: fanotify_encode_fid(): variable init Fabian Frederick
@ 2020-05-11 21:36 ` Amir Goldstein
  0 siblings, 0 replies; 2+ messages in thread
From: Amir Goldstein @ 2020-05-11 21:36 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-fsdevel

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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-11 21:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 17:59 [PATCH 2/9 linux-next] fanotify: fanotify_encode_fid(): variable init Fabian Frederick
2020-05-11 21:36 ` Amir Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).