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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux