aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/info.c3
-rw-r--r--sound/core/info_oss.c3
-rw-r--r--sound/core/memory.c41
-rw-r--r--sound/core/oss/mixer_oss.c3
-rw-r--r--sound/core/oss/pcm_oss.c3
-rw-r--r--sound/core/sound.c2
-rw-r--r--sound/core/timer.c3
-rw-r--r--sound/isa/gus/gus_mem.c7
-rw-r--r--sound/pci/hda/patch_realtek.c2
-rw-r--r--sound/synth/emux/emux.c3
10 files changed, 32 insertions, 38 deletions
diff --git a/sound/core/info.c b/sound/core/info.c
index 31faffe01cb..5e122bbe7c9 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -24,6 +24,7 @@
#include <linux/vmalloc.h>
#include <linux/time.h>
#include <linux/smp_lock.h>
+#include <linux/string.h>
#include <sound/core.h>
#include <sound/minors.h>
#include <sound/info.h>
@@ -754,7 +755,7 @@ static snd_info_entry_t *snd_info_create_entry(const char *name)
entry = kcalloc(1, sizeof(*entry), GFP_KERNEL);
if (entry == NULL)
return NULL;
- entry->name = snd_kmalloc_strdup(name, GFP_KERNEL);
+ entry->name = kstrdup(name, GFP_KERNEL);
if (entry->name == NULL) {
kfree(entry);
return NULL;
diff --git a/sound/core/info_oss.c b/sound/core/info_oss.c
index f9e4ce44345..12107968d40 100644
--- a/sound/core/info_oss.c
+++ b/sound/core/info_oss.c
@@ -22,6 +22,7 @@
#include <sound/driver.h>
#include <linux/slab.h>
#include <linux/time.h>
+#include <linux/string.h>
#include <sound/core.h>
#include <sound/minors.h>
#include <sound/info.h>
@@ -51,7 +52,7 @@ int snd_oss_info_register(int dev, int num, char *string)
x = NULL;
}
} else {
- x = snd_kmalloc_strdup(string, GFP_KERNEL);
+ x = kstrdup(string, GFP_KERNEL);
if (x == NULL) {
up(&strings);
return -ENOMEM;
diff --git a/sound/core/memory.c b/sound/core/memory.c
index 20860fec936..c1fb28e8433 100644
--- a/sound/core/memory.c
+++ b/sound/core/memory.c
@@ -184,6 +184,20 @@ void snd_hidden_vfree(void *obj)
snd_wrapper_vfree(obj);
}
+char *snd_hidden_kstrdup(const char *s, int flags)
+{
+ int len;
+ char *buf;
+
+ if (!s) return NULL;
+
+ len = strlen(s) + 1;
+ buf = _snd_kmalloc(len, flags);
+ if (buf)
+ memcpy(buf, s, len);
+ return buf;
+}
+
static void snd_memory_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer)
{
snd_iprintf(buffer, "kmalloc: %li bytes\n", snd_alloc_kmalloc);
@@ -214,36 +228,9 @@ int __exit snd_memory_info_done(void)
return 0;
}
-#else
-
-#define _snd_kmalloc kmalloc
-
#endif /* CONFIG_SND_DEBUG_MEMORY */
/**
- * snd_kmalloc_strdup - copy the string
- * @string: the original string
- * @flags: allocation conditions, GFP_XXX
- *
- * Allocates a memory chunk via kmalloc() and copies the string to it.
- *
- * Returns the pointer, or NULL if no enoguh memory.
- */
-char *snd_kmalloc_strdup(const char *string, int flags)
-{
- size_t len;
- char *ptr;
-
- if (!string)
- return NULL;
- len = strlen(string) + 1;
- ptr = _snd_kmalloc(len, flags);
- if (ptr)
- memcpy(ptr, string, len);
- return ptr;
-}
-
-/**
* copy_to_user_fromio - copy data from mmio-space to user-space
* @dst: the destination pointer on user-space
* @src: the source pointer on mmio
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 98ed9a9f0da..98fc0766f88 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -24,6 +24,7 @@
#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/time.h>
+#include <linux/string.h>
#include <sound/core.h>
#include <sound/minors.h>
#include <sound/control.h>
@@ -1137,7 +1138,7 @@ static void snd_mixer_oss_proc_write(snd_info_entry_t *entry,
goto __unlock;
}
tbl->oss_id = ch;
- tbl->name = snd_kmalloc_strdup(str, GFP_KERNEL);
+ tbl->name = kstrdup(str, GFP_KERNEL);
if (! tbl->name) {
kfree(tbl);
goto __unlock;
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index cab30977e7c..de7444c586f 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -33,6 +33,7 @@
#include <linux/time.h>
#include <linux/vmalloc.h>
#include <linux/moduleparam.h>
+#include <linux/string.h>
#include <sound/core.h>
#include <sound/minors.h>
#include <sound/pcm.h>
@@ -2360,7 +2361,7 @@ static void snd_pcm_oss_proc_write(snd_info_entry_t *entry,
for (setup1 = pstr->oss.setup_list; setup1->next; setup1 = setup1->next);
setup1->next = setup;
}
- template.task_name = snd_kmalloc_strdup(task_name, GFP_KERNEL);
+ template.task_name = kstrdup(task_name, GFP_KERNEL);
} else {
buffer->error = -ENOMEM;
}
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 0815fadeb3e..7612884f530 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -399,8 +399,8 @@ EXPORT_SYMBOL(snd_hidden_kcalloc);
EXPORT_SYMBOL(snd_hidden_kfree);
EXPORT_SYMBOL(snd_hidden_vmalloc);
EXPORT_SYMBOL(snd_hidden_vfree);
+EXPORT_SYMBOL(snd_hidden_kstrdup);
#endif
-EXPORT_SYMBOL(snd_kmalloc_strdup);
EXPORT_SYMBOL(copy_to_user_fromio);
EXPORT_SYMBOL(copy_from_user_toio);
/* init.c */
diff --git a/sound/core/timer.c b/sound/core/timer.c
index b498e5482d7..cfaccd415b3 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -26,6 +26,7 @@
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/moduleparam.h>
+#include <linux/string.h>
#include <sound/core.h>
#include <sound/timer.h>
#include <sound/control.h>
@@ -100,7 +101,7 @@ static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *ti
timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL);
if (timeri == NULL)
return NULL;
- timeri->owner = snd_kmalloc_strdup(owner, GFP_KERNEL);
+ timeri->owner = kstrdup(owner, GFP_KERNEL);
if (! timeri->owner) {
kfree(timeri);
return NULL;
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
index 609838e8ef6..5eb766dd564 100644
--- a/sound/isa/gus/gus_mem.c
+++ b/sound/isa/gus/gus_mem.c
@@ -21,6 +21,7 @@
#include <sound/driver.h>
#include <linux/slab.h>
+#include <linux/string.h>
#include <sound/core.h>
#include <sound/gus.h>
#include <sound/info.h>
@@ -213,7 +214,7 @@ snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner,
if (share_id != NULL)
memcpy(&block.share_id, share_id, sizeof(block.share_id));
block.owner = owner;
- block.name = snd_kmalloc_strdup(name, GFP_KERNEL);
+ block.name = kstrdup(name, GFP_KERNEL);
nblock = snd_gf1_mem_xalloc(alloc, &block);
snd_gf1_mem_lock(alloc, 1);
return nblock;
@@ -253,13 +254,13 @@ int snd_gf1_mem_init(snd_gus_card_t * gus)
if (gus->gf1.enh_mode) {
block.ptr = 0;
block.size = 1024;
- block.name = snd_kmalloc_strdup("InterWave LFOs", GFP_KERNEL);
+ block.name = kstrdup("InterWave LFOs", GFP_KERNEL);
if (snd_gf1_mem_xalloc(alloc, &block) == NULL)
return -ENOMEM;
}
block.ptr = gus->gf1.default_voice_address;
block.size = 4;
- block.name = snd_kmalloc_strdup("Voice default (NULL's)", GFP_KERNEL);
+ block.name = kstrdup("Voice default (NULL's)", GFP_KERNEL);
if (snd_gf1_mem_xalloc(alloc, &block) == NULL)
return -ENOMEM;
#ifdef CONFIG_SND_DEBUG
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9edd558d6bd..bab89843d85 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1781,7 +1781,7 @@ static int add_control(struct alc_spec *spec, int type, const char *name, unsign
knew = &spec->kctl_alloc[spec->num_kctl_used];
*knew = alc880_control_templates[type];
- knew->name = snd_kmalloc_strdup(name, GFP_KERNEL);
+ knew->name = kstrdup(name, GFP_KERNEL);
if (! knew->name)
return -ENOMEM;
knew->private_value = val;
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c
index 16f3b461627..60d0b2c6669 100644
--- a/sound/synth/emux/emux.c
+++ b/sound/synth/emux/emux.c
@@ -22,6 +22,7 @@
#include <linux/wait.h>
#include <linux/sched.h>
#include <linux/slab.h>
+#include <linux/string.h>
#include <sound/core.h>
#include <sound/emux_synth.h>
#include <linux/init.h>
@@ -76,7 +77,7 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name)
snd_assert(name != NULL, return -EINVAL);
emu->card = card;
- emu->name = snd_kmalloc_strdup(name, GFP_KERNEL);
+ emu->name = kstrdup(name, GFP_KERNEL);
emu->voices = kcalloc(emu->max_voices, sizeof(snd_emux_voice_t), GFP_KERNEL);
if (emu->voices == NULL)
return -ENOMEM;