summaryrefslogtreecommitdiff
path: root/drivers/media/video/cx25821/cx25821-audio-upstream.c
diff options
context:
space:
mode:
authorThomas Meyer <thomas@m3y3r.de>2011-11-18 02:12:18 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-25 03:08:01 +0400
commit0ceaec188e7784c7f9ab5fca110fecb790837dbc (patch)
tree4bc85ca8ae3b991cbcddb9099d690a8c797d049b /drivers/media/video/cx25821/cx25821-audio-upstream.c
parent82c80f8371835f861bdbe50eefa5f49888d23210 (diff)
downloadlinux-0ceaec188e7784c7f9ab5fca110fecb790837dbc.tar.xz
[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-audio-upstream.c')
-rw-r--r--drivers/media/video/cx25821/cx25821-audio-upstream.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/media/video/cx25821/cx25821-audio-upstream.c b/drivers/media/video/cx25821/cx25821-audio-upstream.c
index 4dc2a241335c..20c7ca3351a8 100644
--- a/drivers/media/video/cx25821/cx25821-audio-upstream.c
+++ b/drivers/media/video/cx25821/cx25821-audio-upstream.c
@@ -733,25 +733,22 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
if (dev->input_audiofilename) {
str_length = strlen(dev->input_audiofilename);
- dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL);
+ dev->_audiofilename = kmemdup(dev->input_audiofilename,
+ str_length + 1, GFP_KERNEL);
if (!dev->_audiofilename)
goto error;
- memcpy(dev->_audiofilename, dev->input_audiofilename,
- str_length + 1);
-
/* Default if filename is empty string */
if (strcmp(dev->input_audiofilename, "") == 0)
dev->_audiofilename = "/root/audioGOOD.wav";
} else {
str_length = strlen(_defaultAudioName);
- dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL);
+ dev->_audiofilename = kmemdup(_defaultAudioName,
+ str_length + 1, GFP_KERNEL);
if (!dev->_audiofilename)
goto error;
-
- memcpy(dev->_audiofilename, _defaultAudioName, str_length + 1);
}
retval = cx25821_sram_channel_setup_upstream_audio(dev, sram_ch,