public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: bcm47xxpart: only register partitions if the trx header was filled
@ 2014-09-21 22:33 Hauke Mehrtens
  2014-09-22 18:28 ` Brian Norris
  2014-09-23 12:27 ` Rafał Miłecki
  0 siblings, 2 replies; 4+ messages in thread
From: Hauke Mehrtens @ 2014-09-21 22:33 UTC (permalink / raw)
  To: computersforpeace
  Cc: Hauke Mehrtens, zajec5, linux-mtd, David.Woodhouse, dedekind1

Sometimes the trx offsets are 0, in that case there is no partition and
we should not try to add one.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/mtd/bcm47xxpart.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index 8057f52..c3f4454 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -168,18 +168,22 @@ static int bcm47xxpart_parse(struct mtd_info *master,
 				i++;
 			}
 
-			bcm47xxpart_add_part(&parts[curr_part++], "linux",
-					     offset + trx->offset[i], 0);
-			i++;
+			if (trx->offset[i]) {
+				bcm47xxpart_add_part(&parts[curr_part++], "linux",
+						     offset + trx->offset[i], 0);
+				i++;
+			}
 
 			/*
 			 * Pure rootfs size is known and can be calculated as:
 			 * trx->length - trx->offset[i]. We don't fill it as
 			 * we want to have jffs2 (overlay) in the same mtd.
 			 */
-			bcm47xxpart_add_part(&parts[curr_part++], "rootfs",
-					     offset + trx->offset[i], 0);
-			i++;
+			if (trx->offset[i]) {
+				bcm47xxpart_add_part(&parts[curr_part++], "rootfs",
+						     offset + trx->offset[i], 0);
+				i++;
+			}
 
 			last_trx_part = curr_part - 1;
 
-- 
1.9.1

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

* Re: [PATCH] mtd: bcm47xxpart: only register partitions if the trx header was filled
  2014-09-21 22:33 [PATCH] mtd: bcm47xxpart: only register partitions if the trx header was filled Hauke Mehrtens
@ 2014-09-22 18:28 ` Brian Norris
  2014-09-23 12:27 ` Rafał Miłecki
  1 sibling, 0 replies; 4+ messages in thread
From: Brian Norris @ 2014-09-22 18:28 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: zajec5, linux-mtd, David.Woodhouse, dedekind1

On Mon, Sep 22, 2014 at 12:33:13AM +0200, Hauke Mehrtens wrote:
> Sometimes the trx offsets are 0, in that case there is no partition and
> we should not try to add one.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/mtd/bcm47xxpart.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
> index 8057f52..c3f4454 100644
> --- a/drivers/mtd/bcm47xxpart.c
> +++ b/drivers/mtd/bcm47xxpart.c
> @@ -168,18 +168,22 @@ static int bcm47xxpart_parse(struct mtd_info *master,
>  				i++;
>  			}
>  
> -			bcm47xxpart_add_part(&parts[curr_part++], "linux",
> -					     offset + trx->offset[i], 0);
> -			i++;
> +			if (trx->offset[i]) {
> +				bcm47xxpart_add_part(&parts[curr_part++], "linux",
> +						     offset + trx->offset[i], 0);

Hmm, this indentation is getting large, and it fails checkpatch now.
But I'm not sure the alternatives are much better right now.

> +				i++;
> +			}
>  
>  			/*
>  			 * Pure rootfs size is known and can be calculated as:
>  			 * trx->length - trx->offset[i]. We don't fill it as
>  			 * we want to have jffs2 (overlay) in the same mtd.
>  			 */
> -			bcm47xxpart_add_part(&parts[curr_part++], "rootfs",
> -					     offset + trx->offset[i], 0);
> -			i++;
> +			if (trx->offset[i]) {
> +				bcm47xxpart_add_part(&parts[curr_part++], "rootfs",
> +						     offset + trx->offset[i], 0);

Same here.

> +				i++;
> +			}
>  
>  			last_trx_part = curr_part - 1;
>  

I'll take this soon if there are no other complaints.

Brian

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

* Re: [PATCH] mtd: bcm47xxpart: only register partitions if the trx header was filled
  2014-09-21 22:33 [PATCH] mtd: bcm47xxpart: only register partitions if the trx header was filled Hauke Mehrtens
  2014-09-22 18:28 ` Brian Norris
@ 2014-09-23 12:27 ` Rafał Miłecki
  2014-10-22  9:05   ` Brian Norris
  1 sibling, 1 reply; 4+ messages in thread
From: Rafał Miłecki @ 2014-09-23 12:27 UTC (permalink / raw)
  To: Hauke Mehrtens
  Cc: Brian Norris, linux-mtd@lists.infradead.org, Woodhouse, David,
	Artem Bityutskiy

On 22 September 2014 00:33, Hauke Mehrtens <hauke@hauke-m.de> wrote:
> diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
> index 8057f52..c3f4454 100644
> --- a/drivers/mtd/bcm47xxpart.c
> +++ b/drivers/mtd/bcm47xxpart.c
> @@ -168,18 +168,22 @@ static int bcm47xxpart_parse(struct mtd_info *master,
>                                 i++;
>                         }
>
> -                       bcm47xxpart_add_part(&parts[curr_part++], "linux",
> -                                            offset + trx->offset[i], 0);
> -                       i++;
> +                       if (trx->offset[i]) {
> +                               bcm47xxpart_add_part(&parts[curr_part++], "linux",
> +                                                    offset + trx->offset[i], 0);

You may at least move "linux" to the next line to don't exceed 80
chars limit. Same for "rootfs" below.

-- 
Rafał

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

* Re: [PATCH] mtd: bcm47xxpart: only register partitions if the trx header was filled
  2014-09-23 12:27 ` Rafał Miłecki
@ 2014-10-22  9:05   ` Brian Norris
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Norris @ 2014-10-22  9:05 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Hauke Mehrtens, linux-mtd@lists.infradead.org, Woodhouse, David,
	Artem Bityutskiy

On Tue, Sep 23, 2014 at 02:27:59PM +0200, Rafał Miłecki wrote:
> On 22 September 2014 00:33, Hauke Mehrtens <hauke@hauke-m.de> wrote:
> > diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
> > index 8057f52..c3f4454 100644
> > --- a/drivers/mtd/bcm47xxpart.c
> > +++ b/drivers/mtd/bcm47xxpart.c
> > @@ -168,18 +168,22 @@ static int bcm47xxpart_parse(struct mtd_info *master,
> >                                 i++;
> >                         }
> >
> > -                       bcm47xxpart_add_part(&parts[curr_part++], "linux",
> > -                                            offset + trx->offset[i], 0);
> > -                       i++;
> > +                       if (trx->offset[i]) {
> > +                               bcm47xxpart_add_part(&parts[curr_part++], "linux",
> > +                                                    offset + trx->offset[i], 0);
> 
> You may at least move "linux" to the next line to don't exceed 80
> chars limit. Same for "rootfs" below.

Rewrapped and pushed to l2-mtd.git.

Brian

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

end of thread, other threads:[~2014-10-22  9:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-21 22:33 [PATCH] mtd: bcm47xxpart: only register partitions if the trx header was filled Hauke Mehrtens
2014-09-22 18:28 ` Brian Norris
2014-09-23 12:27 ` Rafał Miłecki
2014-10-22  9:05   ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox