aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parport/parport_sunbpp.c
diff options
context:
space:
mode:
authorSilviu-Mihai Popescu <silviupopescu1990@gmail.com>2013-03-11 18:39:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 10:42:06 -0700
commit2451a84839187cd9d150ff1bfac4f5febbcce7a6 (patch)
tree85b69835c9a8dab587e9f60b01422ed4f318a8a9 /drivers/parport/parport_sunbpp.c
parentparport: amiga: use module_platform_driver_probe() (diff)
downloadlinux-dev-2451a84839187cd9d150ff1bfac4f5febbcce7a6.tar.xz
linux-dev-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_sunbpp.c')
-rw-r--r--drivers/parport/parport_sunbpp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
index 5c4b6a1db6ca..dffd6d0bd15b 100644
--- a/drivers/parport/parport_sunbpp.c
+++ b/drivers/parport/parport_sunbpp.c
@@ -284,12 +284,11 @@ static int bpp_probe(struct platform_device *op)
size = resource_size(&op->resource[0]);
dma = PARPORT_DMA_NONE;
- ops = kmalloc(sizeof(struct parport_operations), GFP_KERNEL);
+ ops = kmemdup(&parport_sunbpp_ops, sizeof(struct parport_operations),
+ GFP_KERNEL);
if (!ops)
goto out_unmap;
- memcpy (ops, &parport_sunbpp_ops, sizeof(struct parport_operations));
-
dprintk(("register_port\n"));
if (!(p = parport_register_port((unsigned long)base, irq, dma, ops)))
goto out_free_ops;