[PATCH] Char: sx, use kcalloc
Convert self-implemented kzalloc to kernel kcalloc. Cc: <R.E.Wolff@BitWizard.nl> Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
5572e10323
commit
4a7cb69bad
|
@ -2267,18 +2267,6 @@ static int sx_init_drivers(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void * ckmalloc (int size)
|
|
||||||
{
|
|
||||||
void *p;
|
|
||||||
|
|
||||||
p = kmalloc(size, GFP_KERNEL);
|
|
||||||
if (p)
|
|
||||||
memset(p, 0, size);
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int sx_init_portstructs (int nboards, int nports)
|
static int sx_init_portstructs (int nboards, int nports)
|
||||||
{
|
{
|
||||||
struct sx_board *board;
|
struct sx_board *board;
|
||||||
|
@ -2291,7 +2279,7 @@ static int sx_init_portstructs (int nboards, int nports)
|
||||||
|
|
||||||
/* Many drivers statically allocate the maximum number of ports
|
/* Many drivers statically allocate the maximum number of ports
|
||||||
There is no reason not to allocate them dynamically. Is there? -- REW */
|
There is no reason not to allocate them dynamically. Is there? -- REW */
|
||||||
sx_ports = ckmalloc(nports * sizeof (struct sx_port));
|
sx_ports = kcalloc(nports, sizeof(struct sx_port), GFP_KERNEL);
|
||||||
if (!sx_ports)
|
if (!sx_ports)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue