On Thu, Jun 10, 2010 at 10:30:26AM -0600, Grant Likely wrote: [...] > C) > struct of_device *alloc_function(int num_res) > { > struct device *ofdev; > struct resource *res; > ofdev = kzalloc(sizeof(*ofdev), GFP_KERNEL) > if (!ofdev) > return NULL; > res = kzalloc((sizeof(*res) * num_res), GFP_KERNEL); > if (!res) { > kfree(ofdev); /* or goto an error unwind label */ > return NULL; > } > res = (struct resource *)&ofdev[1];
You mean ofdev->resource = res; ? > That being said, I'm looking at refactoring to use > platform_device_alloc() instead, which is effectively option C. (which > I'd normally avoid, but it removes otherwise duplicate code from > drivers/of). Sounds great! Thanks, -- Anton Vorontsov email: cbouatmai...@gmail.com irc://irc.freenode.net/bd2 _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev