Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: Dan Ehrenberg <dehrenberg@chromium.org>
Cc: Richard Weinberger <richard@nod.at>,
	gwendal@chromium.org, linux-mtd@lists.infradead.org,
	ezequiel@vanguardiasur.com.ar
Subject: Re: [PATCH v4 3/3] mtd: part: Remove partition overlap checks
Date: Tue, 31 Mar 2015 11:45:21 -0700	[thread overview]
Message-ID: <20150331184521.GX32500@ld-irv-0074> (raw)
In-Reply-To: <1427749298-31714-4-git-send-email-dehrenberg@chromium.org>

On Mon, Mar 30, 2015 at 02:01:38PM -0700, Dan Ehrenberg wrote:
> This patch makes MTD dynamic partitioning more flexible by removing
> overlap checks for dynamic partitions. I don't see any  particular
> reason why overlapping dynamic partitions should be prohibited while
> static partitions are allowed to overlap freely.
> 
> The checks previously had an off-by-one error, where 'end' should be
> one less than what it is currently set at, and adding partitions out of
> increasing order will fail. Disabling the checks resolves this issue.
> 
> Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org>
> ---
>  drivers/mtd/mtdpart.c | 17 +----------------
>  1 file changed, 1 insertion(+), 16 deletions(-)
> 
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index be80340..c444842 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -582,7 +582,7 @@ int mtd_add_partition(struct mtd_info *master, const char *name,
>  		      long long offset, long long length)
>  {
>  	struct mtd_partition part;
> -	struct mtd_part *p, *new;
> +	struct mtd_part *new;
>  	uint64_t start, end;

drivers/mtd/mtdpart.c: In function ‘mtd_add_partition’:
drivers/mtd/mtdpart.c:586:18: warning: variable ‘end’ set but not used [-Wunused-but-set-variable]
  uint64_t start, end;
                  ^
drivers/mtd/mtdpart.c:586:11: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]
  uint64_t start, end;
           ^

>  	int ret = 0;
>  
> @@ -611,17 +611,6 @@ int mtd_add_partition(struct mtd_info *master, const char *name,
>  	end = offset + length;
>  
>  	mutex_lock(&mtd_partitions_mutex);
> -	list_for_each_entry(p, &mtd_partitions, list)
> -		if (p->master == master) {
> -			if ((start >= p->offset) &&
> -			    (start < (p->offset + p->mtd.size)))
> -				goto err_inv;
> -
> -			if ((end >= p->offset) &&
> -			    (end < (p->offset + p->mtd.size)))
> -				goto err_inv;
> -		}
> -
>  	list_add(&new->list, &mtd_partitions);
>  	mutex_unlock(&mtd_partitions_mutex);
>  
> @@ -630,10 +619,6 @@ int mtd_add_partition(struct mtd_info *master, const char *name,
>  	mtd_add_partition_attrs(new);
>  
>  	return ret;
> -err_inv:
> -	mutex_unlock(&mtd_partitions_mutex);
> -	free_partition(new);
> -	return -EINVAL;
>  }
>  EXPORT_SYMBOL_GPL(mtd_add_partition);
>  

Brian

      reply	other threads:[~2015-03-31 18:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 21:01 [PATCH v4 0/3] Improve MTD dynamic partitioning support Dan Ehrenberg
2015-03-30 21:01 ` [PATCH v4 1/3] mtd: part: Create the master device node when partitioned Dan Ehrenberg
2015-03-30 21:01 ` [PATCH v4 2/3] mtd: part: Add sysfs variable for offset of partition Dan Ehrenberg
2015-03-30 21:01 ` [PATCH v4 3/3] mtd: part: Remove partition overlap checks Dan Ehrenberg
2015-03-31 18:45   ` Brian Norris [this message]

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=20150331184521.GX32500@ld-irv-0074 \
    --to=computersforpeace@gmail.com \
    --cc=dehrenberg@chromium.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=gwendal@chromium.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    /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