aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx25821/cx25821-audio-upstream.c
diff options
context:
space:
mode:
authorThomas Meyer <thomas@m3y3r.de>2011-11-17 17:12:18 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-24 18:08:01 -0500
commit0ceaec188e7784c7f9ab5fca110fecb790837dbc (patch)
tree4bc85ca8ae3b991cbcddb9099d690a8c797d049b /drivers/media/video/cx25821/cx25821-audio-upstream.c
parent82c80f8371835f861bdbe50eefa5f49888d23210 (diff)
[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)
733 733
734 if (dev->input_audiofilename) { 734 if (dev->input_audiofilename) {
735 str_length = strlen(dev->input_audiofilename); 735 str_length = strlen(dev->input_audiofilename);
736 dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL); 736 dev->_audiofilename = kmemdup(dev->input_audiofilename,
737 str_length + 1, GFP_KERNEL);
737 738
738 if (!dev->_audiofilename) 739 if (!dev->_audiofilename)
739 goto error; 740 goto error;
740 741
741 memcpy(dev->_audiofilename, dev->input_audiofilename,
742 str_length + 1);
743
744 /* Default if filename is empty string */ 742 /* Default if filename is empty string */
745 if (strcmp(dev->input_audiofilename, "") == 0) 743 if (strcmp(dev->input_audiofilename, "") == 0)
746 dev->_audiofilename = "/root/audioGOOD.wav"; 744 dev->_audiofilename = "/root/audioGOOD.wav";
747 } else { 745 } else {
748 str_length = strlen(_defaultAudioName); 746 str_length = strlen(_defaultAudioName);
749 dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL); 747 dev->_audiofilename = kmemdup(_defaultAudioName,
748 str_length + 1, GFP_KERNEL);
750 749
751 if (!dev->_audiofilename) 750 if (!dev->_audiofilename)
752 goto error; 751 goto error;
753
754 memcpy(dev->_audiofilename, _defaultAudioName, str_length + 1);
755 } 752 }
756 753
757 retval = cx25821_sram_channel_setup_upstream_audio(dev, sram_ch, 754 retval = cx25821_sram_channel_setup_upstream_audio(dev, sram_ch,