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

Stefan Roese sr at denx.de
Tue Apr 14 22:57:06 EST 2009


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



More information about the devicetree-discuss mailing list