From 2451a84839187cd9d150ff1bfac4f5febbcce7a6 Mon Sep 17 00:00:00 2001 From: Silviu-Mihai Popescu Date: Mon, 11 Mar 2013 18:39:22 +0200 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/parport/parport_sunbpp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/parport/parport_sunbpp.c') 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; -- cgit v1.2.3