Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1233172 > unrolled thread

[PATCH] btrfs: remove unneeded NULL initializer for struct fs_path

Started byAlexandru Moise <00moses.alexander00@gmail.com>
First post2015-09-26 11:10 +0200
Last post2015-09-29 18:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] btrfs: remove unneeded NULL initializer for struct fs_path Alexandru Moise <00moses.alexander00@gmail.com> - 2015-09-26 11:10 +0200
    Re: [PATCH] btrfs: remove unneeded NULL initializer for struct  fs_path David Sterba <dsterba@suse.cz> - 2015-09-29 14:40 +0200
      Re: [PATCH] btrfs: remove unneeded NULL initializer for struct  fs_path Alexandru Moise <00moses.alexander00@gmail.com> - 2015-09-29 18:40 +0200

#1233172 — [PATCH] btrfs: remove unneeded NULL initializer for struct fs_path

FromAlexandru Moise <00moses.alexander00@gmail.com>
Date2015-09-26 11:10 +0200
Subject[PATCH] btrfs: remove unneeded NULL initializer for struct fs_path
Message-ID<qcTEu-3SO-3@gated-at.bofh.it>
fs_path_alloc() either returns an alloc'ed struct fs_path
or NULL, no need to initialize the pointer to NULL.

Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com>
---
 fs/btrfs/send.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index aa72bfd..0019c90 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -2230,7 +2230,7 @@ static int get_cur_path(struct send_ctx *sctx, u64 ino, u64 gen,
 			struct fs_path *dest)
 {
 	int ret = 0;
-	struct fs_path *name = NULL;
+	struct fs_path *name;
 	u64 parent_inode = 0;
 	u64 parent_gen = 0;
 	int stop = 0;
-- 
2.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1235026 — Re: [PATCH] btrfs: remove unneeded NULL initializer for struct fs_path

FromDavid Sterba <dsterba@suse.cz>
Date2015-09-29 14:40 +0200
SubjectRe: [PATCH] btrfs: remove unneeded NULL initializer for struct fs_path
Message-ID<qe2mn-6A8-29@gated-at.bofh.it>
In reply to#1233172
On Sat, Sep 26, 2015 at 12:05:19PM +0000, Alexandru Moise wrote:
> fs_path_alloc() either returns an alloc'ed struct fs_path
> or NULL, no need to initialize the pointer to NULL.
> 
> Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com>
> ---
>  fs/btrfs/send.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index aa72bfd..0019c90 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -2230,7 +2230,7 @@ static int get_cur_path(struct send_ctx *sctx, u64 ino, u64 gen,
>  			struct fs_path *dest)
>  {
>  	int ret = 0;
> -	struct fs_path *name = NULL;
> +	struct fs_path *name;

I'd rather see all such instances fixed in one patch. Quick grep
revealed a few more. OTOH this kind of extra initialization is harmless
and sometimes help readability, it's clear that he value is zeroed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1235376 — Re: [PATCH] btrfs: remove unneeded NULL initializer for struct fs_path

FromAlexandru Moise <00moses.alexander00@gmail.com>
Date2015-09-29 18:40 +0200
SubjectRe: [PATCH] btrfs: remove unneeded NULL initializer for struct fs_path
Message-ID<qe66D-3vi-39@gated-at.bofh.it>
In reply to#1235026
On Tue, Sep 29, 2015 at 02:32:29PM +0200, David Sterba wrote:
> On Sat, Sep 26, 2015 at 12:05:19PM +0000, Alexandru Moise wrote:
> > fs_path_alloc() either returns an alloc'ed struct fs_path
> > or NULL, no need to initialize the pointer to NULL.
> > 
> > Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com>
> > ---
> >  fs/btrfs/send.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> > index aa72bfd..0019c90 100644
> > --- a/fs/btrfs/send.c
> > +++ b/fs/btrfs/send.c
> > @@ -2230,7 +2230,7 @@ static int get_cur_path(struct send_ctx *sctx, u64 ino, u64 gen,
> >  			struct fs_path *dest)
> >  {
> >  	int ret = 0;
> > -	struct fs_path *name = NULL;
> > +	struct fs_path *name;
> 
> I'd rather see all such instances fixed in one patch. Quick grep
> revealed a few more. OTOH this kind of extra initialization is harmless
> and sometimes help readability, it's clear that he value is zeroed.

When you put it like that, you are right, it's more important to make
things obvious than to fiercely abide by all the subtleties of our
coding style. I submit to your point of view and will not insist on
this kind of change in the future.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web