public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: zajec5@gmail.com, linux-mtd@lists.infradead.org,
	David.Woodhouse@intel.com, dedekind1@gmail.com
Subject: Re: [PATCH] mtd: bcm47xxpart: only register partitions if the trx header was filled
Date: Mon, 22 Sep 2014 11:28:37 -0700	[thread overview]
Message-ID: <20140922182837.GP1193@ld-irv-0074> (raw)
In-Reply-To: <1411338793-21245-1-git-send-email-hauke@hauke-m.de>

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

  reply	other threads:[~2014-09-22 18:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2014-09-23 12:27 ` Rafał Miłecki
2014-10-22  9:05   ` Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140922182837.GP1193@ld-irv-0074 \
    --to=computersforpeace@gmail.com \
    --cc=David.Woodhouse@intel.com \
    --cc=dedekind1@gmail.com \
    --cc=hauke@hauke-m.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=zajec5@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox