Re: [RFC][PATCH 2.6.19 2/6] support multiple logging agents

From: Andy Isaacson
Date: Wed Dec 13 2006 - 16:42:26 EST


On Tue, Dec 12, 2006 at 12:42:50PM -0600, Matt Mackall wrote:
> > + new_dev = (struct netconsole_device*)kmalloc(
> > + sizeof(struct netconsole_device), GFP_ATOMIC);
>
> Cast of void * is unnecessary.

Also,
1. use kzalloc rather than kmalloc+memset
2. use p = kzalloc(sizeof(*p) rather than p = kzalloc(sizeof(struct foo)
3. use goto to common error exit code rather than local return

> > + if (!new_dev) {
> > + printk(KERN_INFO "netconsole: kmalloc() failed!\n");
> > + kfree(netcon_dev_config);
> > + return -ENOMEM;
> > + }
> > + memset(new_dev, 0, sizeof(struct netconsole_device));

-andy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/