Re: [PATCH 1/6] mtd: afs: simplify partition parsing

Liviu Dudau
2019-02-05T11:25:39Z

On Thu, Jan 31, 2019 at 06:45:03PM +0100, Boris Brezillon wrote:
> Hi Liviu,
>
> On Thu, 31 Jan 2019 17:13:27 +0000
> Liviu Dudau <liviu.dudau@arm.com> wrote:
>
> > Hi Linus,
> >
> > On Mon, Jan 28, 2019 at 02:54:44PM +0100, Linus Walleij wrote:
> > > This simplifies the AFS partition parsing to make the code
> > > more straight-forward and readable.
> > >
> > > Before this patch the code tried to calculate the memory required
> > > to hold the partition info by adding up the sizes of the strings
> > > of the names and adding that to a single memory allocation,
> > > indexing the name pointers in front of the struct mtd_partition
> > > allocations so all allocated data was in one chunk.
> > >
> > > This is overzealous. Instead use kstrdup and bail out,
> > > kfree():ing the memory used for MTD partitions and names alike
> > > on the errorpath.
> > >
> > > In the process rename the index variable from idx to i.
> > >
> > > Cc: Ryan Harkin <ryan.harkin@linaro.org>
> > > Cc: Liviu Dudau <liviu.dudau@arm.com>
> > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > > ---
> > > drivers/mtd/parsers/afs.c | 67 +++++++++++++++++++--------------------
> >
> > What kernel is this series based on? Current Torvalds' tree has the
> > afs.c file in drivers/mtd and not in drivers/mtd/parsers/. Is there a
> > patch that I'm missing moving things around?
>
> It depends on this series [1] (mentioned in the cover letter).

Funny that, but the cover letter was missing from the series I've
received :)

Thanks for the info!

Best regards,
Liviu

>
> Regards,
>
> Boris
>
> [1]http://patchwork.ozlabs.org/project/linux-mtd/list/?series=87760

--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯