2015-05-15 21:44:15

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH 1/6 linux-next] ubifs: remove unnecessary semi-colon

semi-colon after case is unneeded.

Signed-off-by: Fabian Frederick <[email protected]>
---
fs/ubifs/sb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index f4fbc7b..50be857 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -586,7 +586,7 @@ int ubifs_read_superblock(struct ubifs_info *c)
c->key_hash = key_test_hash;
c->key_hash_type = UBIFS_KEY_HASH_TEST;
break;
- };
+ }

c->key_fmt = sup->key_fmt;

--
2.4.0


2015-05-15 21:44:20

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH 2/6 linux-next] ubifs: simplify return in shrink_liability()

Directly return ubifs_return_leb()
instead of storing value in err and testing it.

Signed-off-by: Fabian Frederick <[email protected]>
---
fs/ubifs/budget.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index 11a11b3..c07b770 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(&c->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);
}

/**
--
2.4.0

2015-05-15 21:45:09

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH 3/6 linux-next] ubifs: simplify return in layout_cnodes()

Directly return dbg_chk_lpt_sz() instead of storing
value in err and testing it.

Signed-off-by: Fabian Frederick <[email protected]>
---
fs/ubifs/lpt_commit.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

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.4.0

2015-05-15 21:44:28

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH 4/6 linux-next] ubifs: simplify return in sort_nodes()

Directly return dbg_check_nondata_nodes_order()
instead of storing value in err and testing it.

Signed-off-by: Fabian Frederick <[email protected]>
---
fs/ubifs/gc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 9718da8..bf0a3eb 100644
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -301,10 +301,7 @@ static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
err = dbg_check_data_nodes_order(c, &sleb->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);
}

/**
--
2.4.0

2015-05-15 21:44:30

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH 5/6 linux-next] ubifs: remove unnecessary else after break

else is not needed after break in dbg_check_old_index()
This also solves the {} parity.

Signed-off-by: Fabian Frederick <[email protected]>
---
fs/ubifs/commit.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c
index 63f5661..dd9ba81 100644
--- a/fs/ubifs/commit.c
+++ b/fs/ubifs/commit.c
@@ -680,9 +680,9 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
if (iip + 1 < le16_to_cpu(idx->child_cnt)) {
iip = iip + 1;
break;
- } else
- /* Nope, so go up again */
- iip = i->iip;
+ }
+ /* Nope, so go up again */
+ iip = i->iip;
}
} else
/* Go down left */
--
2.4.0

2015-05-15 21:44:49

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH 6/6 linux-next] ubifs: remove else after return

simplify code in add_to_lpt_heap()

Signed-off-by: Fabian Frederick <[email protected]>
---
fs/ubifs/lprops.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
index a0011aa..e1454cf 100644
--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -208,13 +208,12 @@ static int add_to_lpt_heap(struct ubifs_info *c, struct ubifs_lprops *lprops,
}
dbg_check_heap(c, heap, cat, -1);
return 0; /* Not added to heap */
- } else {
- lprops->hpos = heap->cnt++;
- heap->arr[lprops->hpos] = lprops;
- move_up_lpt_heap(c, heap, lprops, cat);
- dbg_check_heap(c, heap, cat, lprops->hpos);
- return 1; /* Added to heap */
}
+ lprops->hpos = heap->cnt++;
+ heap->arr[lprops->hpos] = lprops;
+ move_up_lpt_heap(c, heap, lprops, cat);
+ dbg_check_heap(c, heap, cat, lprops->hpos);
+ return 1; /* Added to heap */
}

/**
--
2.4.0

2015-05-18 22:17:13

by Richard Weinberger

[permalink] [raw]
Subject: Re: [PATCH 6/6 linux-next] ubifs: remove else after return

On Fri, May 15, 2015 at 11:44 PM, Fabian Frederick <[email protected]> wrote:
> simplify code in add_to_lpt_heap()
>
> Signed-off-by: Fabian Frederick <[email protected]>
> ---
> fs/ubifs/lprops.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
> index a0011aa..e1454cf 100644
> --- a/fs/ubifs/lprops.c
> +++ b/fs/ubifs/lprops.c
> @@ -208,13 +208,12 @@ static int add_to_lpt_heap(struct ubifs_info *c, struct ubifs_lprops *lprops,
> }
> dbg_check_heap(c, heap, cat, -1);
> return 0; /* Not added to heap */
> - } else {
> - lprops->hpos = heap->cnt++;
> - heap->arr[lprops->hpos] = lprops;
> - move_up_lpt_heap(c, heap, lprops, cat);
> - dbg_check_heap(c, heap, cat, lprops->hpos);
> - return 1; /* Added to heap */
> }
> + lprops->hpos = heap->cnt++;
> + heap->arr[lprops->hpos] = lprops;
> + move_up_lpt_heap(c, heap, lprops, cat);
> + dbg_check_heap(c, heap, cat, lprops->hpos);
> + return 1; /* Added to heap */

Just because of paranoia, did you test your changes?

--
Thanks,
//richard

2015-05-19 17:42:27

by Fabian Frédérick

[permalink] [raw]
Subject: Re: [PATCH 6/6 linux-next] ubifs: remove else after return



> On 19 May 2015 at 00:17 Richard Weinberger <[email protected]>
> wrote:
>
>
> On Fri, May 15, 2015 at 11:44 PM, Fabian Frederick <[email protected]> wrote:
> > simplify code in add_to_lpt_heap()
> >
> > Signed-off-by: Fabian Frederick <[email protected]>
> > ---
> >  fs/ubifs/lprops.c | 11 +++++------
> >  1 file changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
> > index a0011aa..e1454cf 100644
> > --- a/fs/ubifs/lprops.c
> > +++ b/fs/ubifs/lprops.c
> > @@ -208,13 +208,12 @@ static int add_to_lpt_heap(struct ubifs_info *c,
> > struct ubifs_lprops *lprops,
> >                 }
> >                 dbg_check_heap(c, heap, cat, -1);
> >                 return 0; /* Not added to heap */
> > -       } else {
> > -               lprops->hpos = heap->cnt++;
> > -               heap->arr[lprops->hpos] = lprops;
> > -               move_up_lpt_heap(c, heap, lprops, cat);
> > -               dbg_check_heap(c, heap, cat, lprops->hpos);
> > -               return 1; /* Added to heap */
> >         }
> > +       lprops->hpos = heap->cnt++;
> > +       heap->arr[lprops->hpos] = lprops;
> > +       move_up_lpt_heap(c, heap, lprops, cat);
> > +       dbg_check_heap(c, heap, cat, lprops->hpos);
> > +       return 1; /* Added to heap */
>
> Just because of paranoia, did you test your changes?

Hello Richard,

        All was compiled but untested.
       
Regards,
Fabian


>
> --
> Thanks,
> //richard

2015-05-19 17:57:23

by Richard Weinberger

[permalink] [raw]
Subject: Re: [PATCH 6/6 linux-next] ubifs: remove else after return

Am 19.05.2015 um 19:42 schrieb Fabian Frederick:
> All was compiled but untested.

Can you please test your changes too?
Trivial looking changes introduce sometimes issues and having them
tested would be wonderful.

You can test UBIFS using nandsim or mtdram on any Linux
system.
See: http://www.linux-mtd.infradead.org/faq/nand.html#L_nand_nandsim

Thanks,
//richard

2015-05-19 21:46:10

by Brian Norris

[permalink] [raw]
Subject: Re: [PATCH 5/6 linux-next] ubifs: remove unnecessary else after break

On Fri, May 15, 2015 at 11:43:59PM +0200, Fabian Frederick wrote:
> else is not needed after break in dbg_check_old_index()
> This also solves the {} parity.
>
> Signed-off-by: Fabian Frederick <[email protected]>
> ---
> fs/ubifs/commit.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c
> index 63f5661..dd9ba81 100644
> --- a/fs/ubifs/commit.c
> +++ b/fs/ubifs/commit.c
> @@ -680,9 +680,9 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
> if (iip + 1 < le16_to_cpu(idx->child_cnt)) {
> iip = iip + 1;
> break;
> - } else
> - /* Nope, so go up again */
> - iip = i->iip;
> + }
> + /* Nope, so go up again */
> + iip = i->iip;
> }
> } else
> /* Go down left */

I think the 'else' structure makes things clearer, so I'd personally
just fix the braces. But of course coding style is more opinion than
science.

Brian

2015-05-22 21:38:05

by Fabian Frédérick

[permalink] [raw]
Subject: Re: [PATCH 6/6 linux-next] ubifs: remove else after return



> On 19 May 2015 at 19:57 Richard Weinberger <[email protected]> wrote:
>
>
> Am 19.05.2015 um 19:42 schrieb Fabian Frederick:
> >         All was compiled but untested.
>
> Can you please test your changes too?
> Trivial looking changes introduce sometimes issues and having them
> tested would be wonderful.
>
> You can test UBIFS using nandsim or mtdram on any Linux
> system.
> See: http://www.linux-mtd.infradead.org/faq/nand.html#L_nand_nandsim

I guess the following patches can be applied without testing ?

http://marc.info/?l=linux-kernel&m=143172631802498&w=2

http://marc.info/?l=linux-kernel&m=143172628602483&w=2

http://marc.info/?l=linux-kernel&m=143172627102471&w=2

Other stuff was indeed purely cosmetic :)

Regards,
Fabian

>
> Thanks,
> //richard

2015-05-22 21:46:20

by Richard Weinberger

[permalink] [raw]
Subject: Re: [PATCH 6/6 linux-next] ubifs: remove else after return

Am 22.05.2015 um 23:37 schrieb Fabian Frederick:
>
>
>> On 19 May 2015 at 19:57 Richard Weinberger <[email protected]> wrote:
>>
>>
>> Am 19.05.2015 um 19:42 schrieb Fabian Frederick:
>>> All was compiled but untested.
>>
>> Can you please test your changes too?
>> Trivial looking changes introduce sometimes issues and having them
>> tested would be wonderful.
>>
>> You can test UBIFS using nandsim or mtdram on any Linux
>> system.
>> See: http://www.linux-mtd.infradead.org/faq/nand.html#L_nand_nandsim
>
> I guess the following patches can be applied without testing ?

Let me put it to you this way, refusing to test your patches does not
increase the possibility to get them merged. :-)

Really, test your patches and don't become a patch bot.

Thanks,
//richard