diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/info.c | 3 | ||||
-rw-r--r-- | sound/core/info_oss.c | 3 | ||||
-rw-r--r-- | sound/core/memory.c | 41 | ||||
-rw-r--r-- | sound/core/oss/mixer_oss.c | 3 | ||||
-rw-r--r-- | sound/core/oss/pcm_oss.c | 3 | ||||
-rw-r--r-- | sound/core/sound.c | 2 | ||||
-rw-r--r-- | sound/core/timer.c | 3 | ||||
-rw-r--r-- | sound/isa/gus/gus_mem.c | 7 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 2 | ||||
-rw-r--r-- | sound/synth/emux/emux.c | 3 |
10 files changed, 32 insertions, 38 deletions
diff --git a/sound/core/info.c b/sound/core/info.c index 31faffe01cb0..5e122bbe7c92 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/vmalloc.h> | 24 | #include <linux/vmalloc.h> |
25 | #include <linux/time.h> | 25 | #include <linux/time.h> |
26 | #include <linux/smp_lock.h> | 26 | #include <linux/smp_lock.h> |
27 | #include <linux/string.h> | ||
27 | #include <sound/core.h> | 28 | #include <sound/core.h> |
28 | #include <sound/minors.h> | 29 | #include <sound/minors.h> |
29 | #include <sound/info.h> | 30 | #include <sound/info.h> |
@@ -754,7 +755,7 @@ static snd_info_entry_t *snd_info_create_entry(const char *name) | |||
754 | entry = kcalloc(1, sizeof(*entry), GFP_KERNEL); | 755 | entry = kcalloc(1, sizeof(*entry), GFP_KERNEL); |
755 | if (entry == NULL) | 756 | if (entry == NULL) |
756 | return NULL; | 757 | return NULL; |
757 | entry->name = snd_kmalloc_strdup(name, GFP_KERNEL); | 758 | entry->name = kstrdup(name, GFP_KERNEL); |
758 | if (entry->name == NULL) { | 759 | if (entry->name == NULL) { |
759 | kfree(entry); | 760 | kfree(entry); |
760 | return NULL; | 761 | return NULL; |
diff --git a/sound/core/info_oss.c b/sound/core/info_oss.c index f9e4ce443454..12107968d402 100644 --- a/sound/core/info_oss.c +++ b/sound/core/info_oss.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/time.h> | 24 | #include <linux/time.h> |
25 | #include <linux/string.h> | ||
25 | #include <sound/core.h> | 26 | #include <sound/core.h> |
26 | #include <sound/minors.h> | 27 | #include <sound/minors.h> |
27 | #include <sound/info.h> | 28 | #include <sound/info.h> |
@@ -51,7 +52,7 @@ int snd_oss_info_register(int dev, int num, char *string) | |||
51 | x = NULL; | 52 | x = NULL; |
52 | } | 53 | } |
53 | } else { | 54 | } else { |
54 | x = snd_kmalloc_strdup(string, GFP_KERNEL); | 55 | x = kstrdup(string, GFP_KERNEL); |
55 | if (x == NULL) { | 56 | if (x == NULL) { |
56 | up(&strings); | 57 | up(&strings); |
57 | return -ENOMEM; | 58 | return -ENOMEM; |
diff --git a/sound/core/memory.c b/sound/core/memory.c index 20860fec9364..c1fb28e84330 100644 --- a/sound/core/memory.c +++ b/sound/core/memory.c | |||
@@ -184,6 +184,20 @@ void snd_hidden_vfree(void *obj) | |||
184 | snd_wrapper_vfree(obj); | 184 | snd_wrapper_vfree(obj); |
185 | } | 185 | } |
186 | 186 | ||
187 | char *snd_hidden_kstrdup(const char *s, int flags) | ||
188 | { | ||
189 | int len; | ||
190 | char *buf; | ||
191 | |||
192 | if (!s) return NULL; | ||
193 | |||
194 | len = strlen(s) + 1; | ||
195 | buf = _snd_kmalloc(len, flags); | ||
196 | if (buf) | ||
197 | memcpy(buf, s, len); | ||
198 | return buf; | ||
199 | } | ||
200 | |||
187 | static void snd_memory_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer) | 201 | static void snd_memory_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer) |
188 | { | 202 | { |
189 | snd_iprintf(buffer, "kmalloc: %li bytes\n", snd_alloc_kmalloc); | 203 | snd_iprintf(buffer, "kmalloc: %li bytes\n", snd_alloc_kmalloc); |
@@ -214,36 +228,9 @@ int __exit snd_memory_info_done(void) | |||
214 | return 0; | 228 | return 0; |
215 | } | 229 | } |
216 | 230 | ||
217 | #else | ||
218 | |||
219 | #define _snd_kmalloc kmalloc | ||
220 | |||
221 | #endif /* CONFIG_SND_DEBUG_MEMORY */ | 231 | #endif /* CONFIG_SND_DEBUG_MEMORY */ |
222 | 232 | ||
223 | /** | 233 | /** |
224 | * snd_kmalloc_strdup - copy the string | ||
225 | * @string: the original string | ||
226 | * @flags: allocation conditions, GFP_XXX | ||
227 | * | ||
228 | * Allocates a memory chunk via kmalloc() and copies the string to it. | ||
229 | * | ||
230 | * Returns the pointer, or NULL if no enoguh memory. | ||
231 | */ | ||
232 | char *snd_kmalloc_strdup(const char *string, int flags) | ||
233 | { | ||
234 | size_t len; | ||
235 | char *ptr; | ||
236 | |||
237 | if (!string) | ||
238 | return NULL; | ||
239 | len = strlen(string) + 1; | ||
240 | ptr = _snd_kmalloc(len, flags); | ||
241 | if (ptr) | ||
242 | memcpy(ptr, string, len); | ||
243 | return ptr; | ||
244 | } | ||
245 | |||
246 | /** | ||
247 | * copy_to_user_fromio - copy data from mmio-space to user-space | 234 | * copy_to_user_fromio - copy data from mmio-space to user-space |
248 | * @dst: the destination pointer on user-space | 235 | * @dst: the destination pointer on user-space |
249 | * @src: the source pointer on mmio | 236 | * @src: the source pointer on mmio |
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 98ed9a9f0da6..98fc0766f885 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/smp_lock.h> | 24 | #include <linux/smp_lock.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
27 | #include <linux/string.h> | ||
27 | #include <sound/core.h> | 28 | #include <sound/core.h> |
28 | #include <sound/minors.h> | 29 | #include <sound/minors.h> |
29 | #include <sound/control.h> | 30 | #include <sound/control.h> |
@@ -1137,7 +1138,7 @@ static void snd_mixer_oss_proc_write(snd_info_entry_t *entry, | |||
1137 | goto __unlock; | 1138 | goto __unlock; |
1138 | } | 1139 | } |
1139 | tbl->oss_id = ch; | 1140 | tbl->oss_id = ch; |
1140 | tbl->name = snd_kmalloc_strdup(str, GFP_KERNEL); | 1141 | tbl->name = kstrdup(str, GFP_KERNEL); |
1141 | if (! tbl->name) { | 1142 | if (! tbl->name) { |
1142 | kfree(tbl); | 1143 | kfree(tbl); |
1143 | goto __unlock; | 1144 | goto __unlock; |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index cab30977e7c0..de7444c586f9 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/time.h> | 33 | #include <linux/time.h> |
34 | #include <linux/vmalloc.h> | 34 | #include <linux/vmalloc.h> |
35 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
36 | #include <linux/string.h> | ||
36 | #include <sound/core.h> | 37 | #include <sound/core.h> |
37 | #include <sound/minors.h> | 38 | #include <sound/minors.h> |
38 | #include <sound/pcm.h> | 39 | #include <sound/pcm.h> |
@@ -2360,7 +2361,7 @@ static void snd_pcm_oss_proc_write(snd_info_entry_t *entry, | |||
2360 | for (setup1 = pstr->oss.setup_list; setup1->next; setup1 = setup1->next); | 2361 | for (setup1 = pstr->oss.setup_list; setup1->next; setup1 = setup1->next); |
2361 | setup1->next = setup; | 2362 | setup1->next = setup; |
2362 | } | 2363 | } |
2363 | template.task_name = snd_kmalloc_strdup(task_name, GFP_KERNEL); | 2364 | template.task_name = kstrdup(task_name, GFP_KERNEL); |
2364 | } else { | 2365 | } else { |
2365 | buffer->error = -ENOMEM; | 2366 | buffer->error = -ENOMEM; |
2366 | } | 2367 | } |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 0815fadeb3ec..7612884f530b 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -399,8 +399,8 @@ EXPORT_SYMBOL(snd_hidden_kcalloc); | |||
399 | EXPORT_SYMBOL(snd_hidden_kfree); | 399 | EXPORT_SYMBOL(snd_hidden_kfree); |
400 | EXPORT_SYMBOL(snd_hidden_vmalloc); | 400 | EXPORT_SYMBOL(snd_hidden_vmalloc); |
401 | EXPORT_SYMBOL(snd_hidden_vfree); | 401 | EXPORT_SYMBOL(snd_hidden_vfree); |
402 | EXPORT_SYMBOL(snd_hidden_kstrdup); | ||
402 | #endif | 403 | #endif |
403 | EXPORT_SYMBOL(snd_kmalloc_strdup); | ||
404 | EXPORT_SYMBOL(copy_to_user_fromio); | 404 | EXPORT_SYMBOL(copy_to_user_fromio); |
405 | EXPORT_SYMBOL(copy_from_user_toio); | 405 | EXPORT_SYMBOL(copy_from_user_toio); |
406 | /* init.c */ | 406 | /* init.c */ |
diff --git a/sound/core/timer.c b/sound/core/timer.c index b498e5482d77..cfaccd415b3b 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
29 | #include <linux/string.h> | ||
29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
30 | #include <sound/timer.h> | 31 | #include <sound/timer.h> |
31 | #include <sound/control.h> | 32 | #include <sound/control.h> |
@@ -100,7 +101,7 @@ static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *ti | |||
100 | timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL); | 101 | timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL); |
101 | if (timeri == NULL) | 102 | if (timeri == NULL) |
102 | return NULL; | 103 | return NULL; |
103 | timeri->owner = snd_kmalloc_strdup(owner, GFP_KERNEL); | 104 | timeri->owner = kstrdup(owner, GFP_KERNEL); |
104 | if (! timeri->owner) { | 105 | if (! timeri->owner) { |
105 | kfree(timeri); | 106 | kfree(timeri); |
106 | return NULL; | 107 | return NULL; |
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c index 609838e8ef67..5eb766dd564b 100644 --- a/sound/isa/gus/gus_mem.c +++ b/sound/isa/gus/gus_mem.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/string.h> | ||
24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
25 | #include <sound/gus.h> | 26 | #include <sound/gus.h> |
26 | #include <sound/info.h> | 27 | #include <sound/info.h> |
@@ -213,7 +214,7 @@ snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner, | |||
213 | if (share_id != NULL) | 214 | if (share_id != NULL) |
214 | memcpy(&block.share_id, share_id, sizeof(block.share_id)); | 215 | memcpy(&block.share_id, share_id, sizeof(block.share_id)); |
215 | block.owner = owner; | 216 | block.owner = owner; |
216 | block.name = snd_kmalloc_strdup(name, GFP_KERNEL); | 217 | block.name = kstrdup(name, GFP_KERNEL); |
217 | nblock = snd_gf1_mem_xalloc(alloc, &block); | 218 | nblock = snd_gf1_mem_xalloc(alloc, &block); |
218 | snd_gf1_mem_lock(alloc, 1); | 219 | snd_gf1_mem_lock(alloc, 1); |
219 | return nblock; | 220 | return nblock; |
@@ -253,13 +254,13 @@ int snd_gf1_mem_init(snd_gus_card_t * gus) | |||
253 | if (gus->gf1.enh_mode) { | 254 | if (gus->gf1.enh_mode) { |
254 | block.ptr = 0; | 255 | block.ptr = 0; |
255 | block.size = 1024; | 256 | block.size = 1024; |
256 | block.name = snd_kmalloc_strdup("InterWave LFOs", GFP_KERNEL); | 257 | block.name = kstrdup("InterWave LFOs", GFP_KERNEL); |
257 | if (snd_gf1_mem_xalloc(alloc, &block) == NULL) | 258 | if (snd_gf1_mem_xalloc(alloc, &block) == NULL) |
258 | return -ENOMEM; | 259 | return -ENOMEM; |
259 | } | 260 | } |
260 | block.ptr = gus->gf1.default_voice_address; | 261 | block.ptr = gus->gf1.default_voice_address; |
261 | block.size = 4; | 262 | block.size = 4; |
262 | block.name = snd_kmalloc_strdup("Voice default (NULL's)", GFP_KERNEL); | 263 | block.name = kstrdup("Voice default (NULL's)", GFP_KERNEL); |
263 | if (snd_gf1_mem_xalloc(alloc, &block) == NULL) | 264 | if (snd_gf1_mem_xalloc(alloc, &block) == NULL) |
264 | return -ENOMEM; | 265 | return -ENOMEM; |
265 | #ifdef CONFIG_SND_DEBUG | 266 | #ifdef CONFIG_SND_DEBUG |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 9edd558d6bd3..bab89843d850 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 | |||
1781 | 1781 | ||
1782 | knew = &spec->kctl_alloc[spec->num_kctl_used]; | 1782 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
1783 | *knew = alc880_control_templates[type]; | 1783 | *knew = alc880_control_templates[type]; |
1784 | knew->name = snd_kmalloc_strdup(name, GFP_KERNEL); | 1784 | knew->name = kstrdup(name, GFP_KERNEL); |
1785 | if (! knew->name) | 1785 | if (! knew->name) |
1786 | return -ENOMEM; | 1786 | return -ENOMEM; |
1787 | knew->private_value = val; | 1787 | knew->private_value = val; |
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c index 16f3b461627a..60d0b2c66698 100644 --- a/sound/synth/emux/emux.c +++ b/sound/synth/emux/emux.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/wait.h> | 22 | #include <linux/wait.h> |
23 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/string.h> | ||
25 | #include <sound/core.h> | 26 | #include <sound/core.h> |
26 | #include <sound/emux_synth.h> | 27 | #include <sound/emux_synth.h> |
27 | #include <linux/init.h> | 28 | #include <linux/init.h> |
@@ -76,7 +77,7 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) | |||
76 | snd_assert(name != NULL, return -EINVAL); | 77 | snd_assert(name != NULL, return -EINVAL); |
77 | 78 | ||
78 | emu->card = card; | 79 | emu->card = card; |
79 | emu->name = snd_kmalloc_strdup(name, GFP_KERNEL); | 80 | emu->name = kstrdup(name, GFP_KERNEL); |
80 | emu->voices = kcalloc(emu->max_voices, sizeof(snd_emux_voice_t), GFP_KERNEL); | 81 | emu->voices = kcalloc(emu->max_voices, sizeof(snd_emux_voice_t), GFP_KERNEL); |
81 | if (emu->voices == NULL) | 82 | if (emu->voices == NULL) |
82 | return -ENOMEM; | 83 | return -ENOMEM; |