parport: use kmemdup instead of kmalloc + memcpy
This replaces calls to kmalloc followed by memcpy with a single call to kmemdup. This was found via make coccicheck. Signed-off-by: Silviu-Mihai Popescu <silviupopescu1990@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
5bcdf0ce2b
commit
2451a84839
@@ -246,14 +246,14 @@ struct parport *parport_gsc_probe_port(unsigned long base,
|
||||
printk (KERN_DEBUG "parport (0x%lx): no memory!\n", base);
|
||||
return NULL;
|
||||
}
|
||||
ops = kmalloc (sizeof (struct parport_operations), GFP_KERNEL);
|
||||
ops = kmemdup(&parport_gsc_ops, sizeof(struct parport_operations),
|
||||
GFP_KERNEL);
|
||||
if (!ops) {
|
||||
printk (KERN_DEBUG "parport (0x%lx): no memory for ops!\n",
|
||||
base);
|
||||
kfree (priv);
|
||||
return NULL;
|
||||
}
|
||||
memcpy (ops, &parport_gsc_ops, sizeof (struct parport_operations));
|
||||
priv->ctr = 0xc;
|
||||
priv->ctr_writable = 0xff;
|
||||
priv->dma_buf = 0;
|
||||
|
Reference in New Issue
Block a user