[PATCH 1/8] mtd: Simplify partitions

Sascha Hauer s.hauer at pengutronix.de
Thu Feb 13 13:45:33 EST 2014


On Thu, Feb 13, 2014 at 03:01:55PM +0100, Alexander Aring wrote:
> On Thu, Feb 13, 2014 at 02:34:30PM +0100, Sascha Hauer wrote:
> > On Thu, Feb 13, 2014 at 12:08:58PM +0100, Alexander Aring wrote:
> > > Hi Sascha,
> > > 
> > > only some small nitpicks.
> > > 
> > > On Thu, Feb 13, 2014 at 11:25:28AM +0100, Sascha Hauer wrote:
> > > > Embed the partition information in struct mtd_info. This makes the
> > > > mtd partition code simpler.
> > > > 
> > > > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > > > ---
> > > >  drivers/mtd/partition.c | 75 ++++++++++++++++++++-----------------------------
> > > >  include/linux/mtd/mtd.h |  5 +++-
> > > >  2 files changed, 34 insertions(+), 46 deletions(-)
> > > > 
> > > > diff --git a/drivers/mtd/partition.c b/drivers/mtd/partition.c
> > > > index 85f486d..7431fc1 100644
> > > > --- a/drivers/mtd/partition.c
> > > > +++ b/drivers/mtd/partition.c
> > > > @@ -4,29 +4,19 @@
> > > >  #include <linux/err.h>
> > > >  #include <linux/mtd/mtd.h>
> > > >  
> > > ...
> > > > +	struct mtd_info *part;
> > > >  	int start = 0, end = 0, i;
> > > >  
> > > > -	slave = xzalloc(sizeof(*slave));
> > > > -	slave_mtd = &slave->mtd;
> > > > +	part = xzalloc(sizeof(*part));
> > > >  
> > > > -	memcpy(slave_mtd, mtd, sizeof(*slave));
> > > > +	memcpy(part, mtd, sizeof(*part));
> > > 
> > > Maybe we should fixup this commit with patch:
> > > 
> > > [PATCH 6/8] mtd: partition: only copy selected fields to partition
> > 
> > I don't think so. Both change the same line, but do quite different
> > things.
> > 
> ok.
> > > > -	struct mtd_part *part = PART(mtd);
> > > > +	if (!part->master)
> > > > +		return -EINVAL;
> > > >  
> > > > -	free(mtd->name);
> > > I think this should be free(part->name);
> > 
> > What do you mean? The line you are referring to is removed in this
> > patch.
> > 
> I mean the part->name = strdup(mtd->name) in add partition function.

Now I get it. It's actually there in the end result but slipped into the
wrong patch. Fixed this.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list