linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6 linux-next] ubifs: remove unnecessary semi-colon
@ 2015-05-15 21:43 Fabian Frederick
  2015-05-15 21:43 ` [PATCH 2/6 linux-next] ubifs: simplify return in shrink_liability() Fabian Frederick
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Fabian Frederick @ 2015-05-15 21:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Artem Bityutskiy, Adrian Hunter, linux-mtd

semi-colon after case is unneeded.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 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


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

* [PATCH 2/6 linux-next] ubifs: simplify return in shrink_liability()
  2015-05-15 21:43 [PATCH 1/6 linux-next] ubifs: remove unnecessary semi-colon Fabian Frederick
@ 2015-05-15 21:43 ` Fabian Frederick
  2015-05-15 21:43 ` [PATCH 3/6 linux-next] ubifs: simplify return in layout_cnodes() Fabian Frederick
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Fabian Frederick @ 2015-05-15 21:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Artem Bityutskiy, Adrian Hunter, linux-mtd

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

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 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


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

* [PATCH 3/6 linux-next] ubifs: simplify return in layout_cnodes()
  2015-05-15 21:43 [PATCH 1/6 linux-next] ubifs: remove unnecessary semi-colon Fabian Frederick
  2015-05-15 21:43 ` [PATCH 2/6 linux-next] ubifs: simplify return in shrink_liability() Fabian Frederick
@ 2015-05-15 21:43 ` Fabian Frederick
  2015-05-15 21:43 ` [PATCH 4/6 linux-next] ubifs: simplify return in sort_nodes() Fabian Frederick
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Fabian Frederick @ 2015-05-15 21:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Artem Bityutskiy, Adrian Hunter, linux-mtd

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

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 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


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

* [PATCH 4/6 linux-next] ubifs: simplify return in sort_nodes()
  2015-05-15 21:43 [PATCH 1/6 linux-next] ubifs: remove unnecessary semi-colon Fabian Frederick
  2015-05-15 21:43 ` [PATCH 2/6 linux-next] ubifs: simplify return in shrink_liability() Fabian Frederick
  2015-05-15 21:43 ` [PATCH 3/6 linux-next] ubifs: simplify return in layout_cnodes() Fabian Frederick
@ 2015-05-15 21:43 ` Fabian Frederick
  2015-05-15 21:43 ` [PATCH 5/6 linux-next] ubifs: remove unnecessary else after break Fabian Frederick
  2015-05-15 21:44 ` [PATCH 6/6 linux-next] ubifs: remove else after return Fabian Frederick
  4 siblings, 0 replies; 12+ messages in thread
From: Fabian Frederick @ 2015-05-15 21:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Artem Bityutskiy, Adrian Hunter, linux-mtd

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

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 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


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

* [PATCH 5/6 linux-next] ubifs: remove unnecessary else after break
  2015-05-15 21:43 [PATCH 1/6 linux-next] ubifs: remove unnecessary semi-colon Fabian Frederick
                   ` (2 preceding siblings ...)
  2015-05-15 21:43 ` [PATCH 4/6 linux-next] ubifs: simplify return in sort_nodes() Fabian Frederick
@ 2015-05-15 21:43 ` Fabian Frederick
  2015-05-19 21:45   ` Brian Norris
  2015-05-15 21:44 ` [PATCH 6/6 linux-next] ubifs: remove else after return Fabian Frederick
  4 siblings, 1 reply; 12+ messages in thread
From: Fabian Frederick @ 2015-05-15 21:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Artem Bityutskiy, Adrian Hunter, linux-mtd

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

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 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


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

* [PATCH 6/6 linux-next] ubifs: remove else after return
  2015-05-15 21:43 [PATCH 1/6 linux-next] ubifs: remove unnecessary semi-colon Fabian Frederick
                   ` (3 preceding siblings ...)
  2015-05-15 21:43 ` [PATCH 5/6 linux-next] ubifs: remove unnecessary else after break Fabian Frederick
@ 2015-05-15 21:44 ` Fabian Frederick
  2015-05-18 22:17   ` Richard Weinberger
  4 siblings, 1 reply; 12+ messages in thread
From: Fabian Frederick @ 2015-05-15 21:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Artem Bityutskiy, Adrian Hunter, linux-mtd

simplify code in add_to_lpt_heap()

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 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


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

* Re: [PATCH 6/6 linux-next] ubifs: remove else after return
  2015-05-15 21:44 ` [PATCH 6/6 linux-next] ubifs: remove else after return Fabian Frederick
@ 2015-05-18 22:17   ` Richard Weinberger
  2015-05-19 17:42     ` Fabian Frederick
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Weinberger @ 2015-05-18 22:17 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: LKML, Artem Bityutskiy, Adrian Hunter, linux-mtd

On Fri, May 15, 2015 at 11:44 PM, Fabian Frederick <fabf@skynet.be> wrote:
> simplify code in add_to_lpt_heap()
>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
>  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

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

* Re: [PATCH 6/6 linux-next] ubifs: remove else after return
  2015-05-18 22:17   ` Richard Weinberger
@ 2015-05-19 17:42     ` Fabian Frederick
  2015-05-19 17:57       ` Richard Weinberger
  0 siblings, 1 reply; 12+ messages in thread
From: Fabian Frederick @ 2015-05-19 17:42 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd, Artem Bityutskiy, LKML, Adrian Hunter



> On 19 May 2015 at 00:17 Richard Weinberger <richard.weinberger@gmail.com>
> wrote:
>
>
> On Fri, May 15, 2015 at 11:44 PM, Fabian Frederick <fabf@skynet.be> wrote:
> > simplify code in add_to_lpt_heap()
> >
> > Signed-off-by: Fabian Frederick <fabf@skynet.be>
> > ---
> >  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

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

* Re: [PATCH 6/6 linux-next] ubifs: remove else after return
  2015-05-19 17:42     ` Fabian Frederick
@ 2015-05-19 17:57       ` Richard Weinberger
  2015-05-22 21:37         ` Fabian Frederick
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Weinberger @ 2015-05-19 17:57 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-mtd, Artem Bityutskiy, LKML, Adrian Hunter

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

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

* Re: [PATCH 5/6 linux-next] ubifs: remove unnecessary else after break
  2015-05-15 21:43 ` [PATCH 5/6 linux-next] ubifs: remove unnecessary else after break Fabian Frederick
@ 2015-05-19 21:45   ` Brian Norris
  0 siblings, 0 replies; 12+ messages in thread
From: Brian Norris @ 2015-05-19 21:45 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-kernel, linux-mtd, Adrian Hunter, Artem Bityutskiy

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 <fabf@skynet.be>
> ---
>  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

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

* Re: [PATCH 6/6 linux-next] ubifs: remove else after return
  2015-05-19 17:57       ` Richard Weinberger
@ 2015-05-22 21:37         ` Fabian Frederick
  2015-05-22 21:46           ` Richard Weinberger
  0 siblings, 1 reply; 12+ messages in thread
From: Fabian Frederick @ 2015-05-22 21:37 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd, Artem Bityutskiy, LKML, Adrian Hunter



> On 19 May 2015 at 19:57 Richard Weinberger <richard@nod.at> 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

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

* Re: [PATCH 6/6 linux-next] ubifs: remove else after return
  2015-05-22 21:37         ` Fabian Frederick
@ 2015-05-22 21:46           ` Richard Weinberger
  0 siblings, 0 replies; 12+ messages in thread
From: Richard Weinberger @ 2015-05-22 21:46 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-mtd, Artem Bityutskiy, LKML, Adrian Hunter

Am 22.05.2015 um 23:37 schrieb Fabian Frederick:
> 
> 
>> On 19 May 2015 at 19:57 Richard Weinberger <richard@nod.at> 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

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

end of thread, other threads:[~2015-05-22 21:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-15 21:43 [PATCH 1/6 linux-next] ubifs: remove unnecessary semi-colon Fabian Frederick
2015-05-15 21:43 ` [PATCH 2/6 linux-next] ubifs: simplify return in shrink_liability() Fabian Frederick
2015-05-15 21:43 ` [PATCH 3/6 linux-next] ubifs: simplify return in layout_cnodes() Fabian Frederick
2015-05-15 21:43 ` [PATCH 4/6 linux-next] ubifs: simplify return in sort_nodes() Fabian Frederick
2015-05-15 21:43 ` [PATCH 5/6 linux-next] ubifs: remove unnecessary else after break Fabian Frederick
2015-05-19 21:45   ` Brian Norris
2015-05-15 21:44 ` [PATCH 6/6 linux-next] ubifs: remove else after return Fabian Frederick
2015-05-18 22:17   ` Richard Weinberger
2015-05-19 17:42     ` Fabian Frederick
2015-05-19 17:57       ` Richard Weinberger
2015-05-22 21:37         ` Fabian Frederick
2015-05-22 21:46           ` Richard Weinberger

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