With something like:
__initfunc(void arc20020_setup (char *str, int *ints))
{
struct device *dev;
dev=kmalloc(sizeof(struct device), GFP_ATOMIC);
printk ("kmalloc returned %p.\n",dev);
if (dev) kfree(dev);
...
I get:
kmem_alloc: NULL ptr (name=unknown)
kmalloc returned 00000000.
At the moment, I've gone back to using an empty array of struct devices and
filling them in one by one, but is there a better way - it wastes a lot of
space like this, and imposes a maximum number of devices than can be
registered.
(Other than declaring the device array as __initdata, kmallocing the necessary space later and copying the used ones across before the __initdata is flushed.)
-- David Woodhouse, CB3 9AN http://dwmw2.robinson.cam.ac.uk/ dwmw2@cam.ac.uk Tel: 0976 658355 D.W.Woodhouse@nortel.co.uk Tel: 01279 402332