Re: [PATCH] ubifs: compress lines for immediate return
Heiko, On 05.09.2016 06:59, Heiko Schocher wrote: > fix the following code: > > -ret = expression; > -if (ret) > -return ret; > -return 0; > +return expression; "Fix"? ;-) What was broken? I agree that we can write the expression in a different way, but is it really worth it? Is this part of a tree-wide cleanup? Thanks, //richard
Re: [PATCH] ubifs: compress lines for immediate return
Heiko, On 05.09.2016 06:59, Heiko Schocher wrote: > fix the following code: > > -ret = expression; > -if (ret) > -return ret; > -return 0; > +return expression; "Fix"? ;-) What was broken? I agree that we can write the expression in a different way, but is it really worth it? Is this part of a tree-wide cleanup? Thanks, //richard
Re: [PATCH] ubifs: compress lines for immediate return
Heiko, On 05.09.2016 08:35, Heiko Schocher wrote: > I think yes ... > >> Is this part of a tree-wide cleanup? > > Yes, and I thought it is worth to change this part in linux too. Agreed. Can you please resend with a proper change log and (more important) a correct sob-chain? From: and first Signed-of-by: should be Masahiro Yamadafollowed by a Signed-of-by: you. Thanks, //richard
Re: [PATCH] ubifs: compress lines for immediate return
Heiko, On 05.09.2016 08:35, Heiko Schocher wrote: > I think yes ... > >> Is this part of a tree-wide cleanup? > > Yes, and I thought it is worth to change this part in linux too. Agreed. Can you please resend with a proper change log and (more important) a correct sob-chain? From: and first Signed-of-by: should be Masahiro Yamada followed by a Signed-of-by: you. Thanks, //richard
Re: [PATCH] ubifs: compress lines for immediate return
Hello Richard, Am 05.09.2016 um 08:28 schrieb Richard Weinberger: Heiko, On 05.09.2016 06:59, Heiko Schocher wrote: fix the following code: -ret = expression; -if (ret) -return ret; -return 0; +return expression; "Fix"? ;-) What was broken? Ok, fix is to hard spoken ... nothing broken, sorry for confusing! I agree that we can write the expression in a different way, but is it really worth it? I think yes ... Is this part of a tree-wide cleanup? Yes, and I thought it is worth to change this part in linux too. bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Re: [PATCH] ubifs: compress lines for immediate return
Hello Richard, Am 05.09.2016 um 08:28 schrieb Richard Weinberger: Heiko, On 05.09.2016 06:59, Heiko Schocher wrote: fix the following code: -ret = expression; -if (ret) -return ret; -return 0; +return expression; "Fix"? ;-) What was broken? Ok, fix is to hard spoken ... nothing broken, sorry for confusing! I agree that we can write the expression in a different way, but is it really worth it? I think yes ... Is this part of a tree-wide cleanup? Yes, and I thought it is worth to change this part in linux too. bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Re: [PATCH] ubifs: compress lines for immediate return
Heiko, On 05.09.2016 08:35, Heiko Schocher wrote: > I think yes ... > >> Is this part of a tree-wide cleanup? > > Yes, and I thought it is worth to change this part in linux too. Agreed. Can you please resend with a proper change log and (more important) a correct sob-chain? From: and first Signed-of-by: should be Masahiro Yamadafollowed by a Signed-of-by: you. Thanks, //richard
Re: [PATCH] ubifs: compress lines for immediate return
Heiko, On 05.09.2016 08:35, Heiko Schocher wrote: > I think yes ... > >> Is this part of a tree-wide cleanup? > > Yes, and I thought it is worth to change this part in linux too. Agreed. Can you please resend with a proper change log and (more important) a correct sob-chain? From: and first Signed-of-by: should be Masahiro Yamada followed by a Signed-of-by: you. Thanks, //richard
Re: [PATCH] ubifs: compress lines for immediate return
Heiko, On 05.09.2016 06:59, Heiko Schocher wrote: > fix the following code: > > -ret = expression; > -if (ret) > -return ret; > -return 0; > +return expression; "Fix"? ;-) What was broken? I agree that we can write the expression in a different way, but is it really worth it? Is this part of a tree-wide cleanup? Thanks, //richard
Re: [PATCH] ubifs: compress lines for immediate return
Heiko, On 05.09.2016 06:59, Heiko Schocher wrote: > fix the following code: > > -ret = expression; > -if (ret) > -return ret; > -return 0; > +return expression; "Fix"? ;-) What was broken? I agree that we can write the expression in a different way, but is it really worth it? Is this part of a tree-wide cleanup? Thanks, //richard
[PATCH] ubifs: compress lines for immediate return
fix the following code: -ret = expression; -if (ret) -return ret; -return 0; +return expression; From: Masahiro Yamadaposted on the U-Boot mailinglist. Signed-off-by: Heiko Schocher --- fs/ubifs/budget.c | 7 ++- fs/ubifs/gc.c | 6 ++ fs/ubifs/lpt_commit.c | 5 + 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c index 11a11b3..48d6851 100644 --- a/fs/ubifs/budget.c +++ b/fs/ubifs/budget.c @@ -77,7 +77,7 @@ static void shrink_liability(struct ubifs_info *c, int nr_to_write) */ static int run_gc(struct ubifs_info *c) { - int err, lnum; + int lnum; /* Make some free space by garbage-collecting dirty space */ down_read(>commit_sem); @@ -88,10 +88,7 @@ static int run_gc(struct ubifs_info *c) /* GC freed one LEB, return it to lprops */ dbg_budg("GC freed LEB %d", lnum); - err = ubifs_return_leb(c, lnum); - if (err) - return err; - return 0; + return = ubifs_return_leb(c, lnum); } /** diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 821b348..88cd61d 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c @@ -297,10 +297,8 @@ static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb, err = dbg_check_data_nodes_order(c, >nodes); if (err) return err; - err = dbg_check_nondata_nodes_order(c, nondata); - if (err) - return err; - return 0; + + return dbg_check_nondata_nodes_order(c, nondata); } /** diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index ce89bdc..79a8e96 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c @@ -313,10 +313,7 @@ static int layout_cnodes(struct ubifs_info *c) alen = ALIGN(offs, c->min_io_size); upd_ltab(c, lnum, c->leb_size - alen, alen - offs); dbg_chk_lpt_sz(c, 4, alen - offs); - err = dbg_chk_lpt_sz(c, 3, alen); - if (err) - return err; - return 0; + return dbg_chk_lpt_sz(c, 3, alen); no_space: ubifs_err(c, "LPT out of space at LEB %d:%d needing %d, done_ltab %d, done_lsave %d", -- 2.5.5
[PATCH] ubifs: compress lines for immediate return
fix the following code: -ret = expression; -if (ret) -return ret; -return 0; +return expression; From: Masahiro Yamada posted on the U-Boot mailinglist. Signed-off-by: Heiko Schocher --- fs/ubifs/budget.c | 7 ++- fs/ubifs/gc.c | 6 ++ fs/ubifs/lpt_commit.c | 5 + 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c index 11a11b3..48d6851 100644 --- a/fs/ubifs/budget.c +++ b/fs/ubifs/budget.c @@ -77,7 +77,7 @@ static void shrink_liability(struct ubifs_info *c, int nr_to_write) */ static int run_gc(struct ubifs_info *c) { - int err, lnum; + int lnum; /* Make some free space by garbage-collecting dirty space */ down_read(>commit_sem); @@ -88,10 +88,7 @@ static int run_gc(struct ubifs_info *c) /* GC freed one LEB, return it to lprops */ dbg_budg("GC freed LEB %d", lnum); - err = ubifs_return_leb(c, lnum); - if (err) - return err; - return 0; + return = ubifs_return_leb(c, lnum); } /** diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 821b348..88cd61d 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c @@ -297,10 +297,8 @@ static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb, err = dbg_check_data_nodes_order(c, >nodes); if (err) return err; - err = dbg_check_nondata_nodes_order(c, nondata); - if (err) - return err; - return 0; + + return dbg_check_nondata_nodes_order(c, nondata); } /** diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index ce89bdc..79a8e96 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c @@ -313,10 +313,7 @@ static int layout_cnodes(struct ubifs_info *c) alen = ALIGN(offs, c->min_io_size); upd_ltab(c, lnum, c->leb_size - alen, alen - offs); dbg_chk_lpt_sz(c, 4, alen - offs); - err = dbg_chk_lpt_sz(c, 3, alen); - if (err) - return err; - return 0; + return dbg_chk_lpt_sz(c, 3, alen); no_space: ubifs_err(c, "LPT out of space at LEB %d:%d needing %d, done_ltab %d, done_lsave %d", -- 2.5.5