[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1367168078-22486-1-git-send-email-gheorghiuandru@gmail.com>
Date: Sun, 28 Apr 2013 19:54:38 +0300
From: Alexandru Gheorghiu <gheorghiuandru@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>,
linux-kernel@...r.kernel.org,
Alexandru Gheorghiu <gheorghiuandru@...il.com>
Subject: [PATCH] drivers: parport: Use kmemdup
Used kmemdup instead of kmalloc and memcpy.
Patch found using coccinelle.
Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@...il.com>
---
drivers/parport/parport_gsc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
index 050773c..4b364c6 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;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists