Subject: Re: [PATCH 1/4 v2] mtd: physmap_of: Add multiple regions and concatenation support

From: Stefan Roese <[email-masked]>
Date: Tue, 14 Apr 2009 14:57:06 +0200

On Sunday 12 April 2009, Grant Likely wrote:
> > +       info = kzalloc(sizeof(struct of_flash) +
> > +                      sizeof(struct of_flash_list) * count, GFP_KERNEL);
> > +       if (!info)
> > +               goto err_out;
> > +
> > +       mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL);
>
> Typically I prefer to see a single kzalloc in a driver which allocates
> all the space needed in one go because it simplifies the error/unwind
> path.

In general ack, but it doesn't make much sense in this case. The 2nd malloc is 
for an temporary buffer needed for mtd_concat_create() call (list of struct 
mtd_info. I can't really combine those two areas. So I'll leave this 
untouched.

Best regards,
Stefan