summaryrefslogtreecommitdiff
path: root/drivers/media/video/cx25821/cx25821-video-upstream.c
diff options
context:
space:
mode:
authorThomas Meyer <thomas@m3y3r.de>2011-11-17 19:12:18 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-24 21:08:01 -0200
commit0ceaec188e7784c7f9ab5fca110fecb790837dbc (patch)
tree4bc85ca8ae3b991cbcddb9099d690a8c797d049b /drivers/media/video/cx25821/cx25821-video-upstream.c
parent82c80f8371835f861bdbe50eefa5f49888d23210 (diff)
downloadlwn-0ceaec188e7784c7f9ab5fca110fecb790837dbc.tar.gz
lwn-0ceaec188e7784c7f9ab5fca110fecb790837dbc.zip
[media] cx25821: Use kmemdup rather than duplicating its implementation
The semantic patch that makes this change is available in scripts/coccinelle/api/memdup.cocci. Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx25821/cx25821-video-upstream.c')
-rw-r--r--drivers/media/video/cx25821/cx25821-video-upstream.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/media/video/cx25821/cx25821-video-upstream.c b/drivers/media/video/cx25821/cx25821-video-upstream.c
index 103226320518..21e7d657f049 100644
--- a/drivers/media/video/cx25821/cx25821-video-upstream.c
+++ b/drivers/media/video/cx25821/cx25821-video-upstream.c
@@ -794,20 +794,18 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select,
if (dev->input_filename) {
str_length = strlen(dev->input_filename);
- dev->_filename = kmalloc(str_length + 1, GFP_KERNEL);
+ dev->_filename = kmemdup(dev->input_filename, str_length + 1,
+ GFP_KERNEL);
if (!dev->_filename)
goto error;
-
- memcpy(dev->_filename, dev->input_filename, str_length + 1);
} else {
str_length = strlen(dev->_defaultname);
- dev->_filename = kmalloc(str_length + 1, GFP_KERNEL);
+ dev->_filename = kmemdup(dev->_defaultname, str_length + 1,
+ GFP_KERNEL);
if (!dev->_filename)
goto error;
-
- memcpy(dev->_filename, dev->_defaultname, str_length + 1);
}
/* Default if filename is empty string */