lkml.org 
[lkml]   [2006]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 2.6.19 2/6] support multiple logging agents
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-12-13 22:45    [W:0.132 / U:0.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site