aboutsummaryrefslogtreecommitdiff
path: root/drivers/parport/procfs.c
diff options
context:
space:
mode:
authorSilviu-Mihai Popescu2013-03-11 18:39:22 +0200
committerGreg Kroah-Hartman2013-03-25 10:42:06 -0700
commit2451a84839187cd9d150ff1bfac4f5febbcce7a6 (patch)
tree85b69835c9a8dab587e9f60b01422ed4f318a8a9 /drivers/parport/procfs.c
parent5bcdf0ce2bf31b09b8707f972c193c6118385526 (diff)
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/procfs.c')
-rw-r--r--drivers/parport/procfs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index 3f56bc086cb5..92ed045a5f93 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -476,10 +476,9 @@ int parport_proc_register(struct parport *port)
struct parport_sysctl_table *t;
int i;
- t = kmalloc(sizeof(*t), GFP_KERNEL);
+ t = kmemdup(&parport_sysctl_template, sizeof(*t), GFP_KERNEL);
if (t == NULL)
return -ENOMEM;
- memcpy(t, &parport_sysctl_template, sizeof(*t));
t->device_dir[0].extra1 = port;
@@ -523,10 +522,9 @@ int parport_device_proc_register(struct pardevice *device)
struct parport_device_sysctl_table *t;
struct parport * port = device->port;
- t = kmalloc(sizeof(*t), GFP_KERNEL);
+ t = kmemdup(&parport_device_sysctl_template, sizeof(*t), GFP_KERNEL);
if (t == NULL)
return -ENOMEM;
- memcpy(t, &parport_device_sysctl_template, sizeof(*t));
t->dev_dir[0].child = t->parport_dir;
t->parport_dir[0].child = t->port_dir;