diff options
author | Silviu-Mihai Popescu <silviupopescu1990@gmail.com> | 2013-03-11 18:39:22 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-25 10:42:06 -0700 |
commit | 2451a84839187cd9d150ff1bfac4f5febbcce7a6 (patch) | |
tree | 85b69835c9a8dab587e9f60b01422ed4f318a8a9 /drivers/parport/parport_gsc.c | |
parent | 5bcdf0ce2bf31b09b8707f972c193c6118385526 (diff) | |
download | linux-2451a84839187cd9d150ff1bfac4f5febbcce7a6.tar.gz linux-2451a84839187cd9d150ff1bfac4f5febbcce7a6.tar.bz2 linux-2451a84839187cd9d150ff1bfac4f5febbcce7a6.zip |
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>
Diffstat (limited to 'drivers/parport/parport_gsc.c')
-rw-r--r-- | drivers/parport/parport_gsc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c index 050773c36823..a5251cb5fb0c 100644 --- a/drivers/parport/parport_gsc.c +++ b/drivers/parport/parport_gsc.c @@ -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; |