Commit 002c171a authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Jaroslav Kysela <perex@suse.cz>

ALSA Core
A try to fix get_id() function - use alloc_bootmem()
parent 323754e8
...@@ -136,29 +136,27 @@ static int snd_legacy_find_free_dma(int *dma_table) ...@@ -136,29 +136,27 @@ static int snd_legacy_find_free_dma(int *dma_table)
#if defined(SNDRV_GET_ID) && !defined(MODULE) #if defined(SNDRV_GET_ID) && !defined(MODULE)
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/bootmem.h>
static int __init get_id(char **str, char **dst) static int __init get_id(char **str, char **dst)
{ {
char *s, *d; char *s;
if (!(*str) || !(**str)) if (!(*str) || !(**str))
return 0; return 0;
for (s = *str; isalpha(*s) || isdigit(*s) || *s == '_'; s++); for (s = *str; isalpha(*s) || isdigit(*s) || *s == '_'; s++);
if (s != *str) { if (s != *str) {
*dst = (char *)kmalloc((s - *str) + 1, GFP_KERNEL); int len = s - *str;
s = *str; d = *dst; char *d = (char *)alloc_bootmem(len + 1);
while (isalpha(*s) || isdigit(*s) || *s == '_') { if (d != NULL) {
if (d != NULL) memcpy(*dst = d, *str, len);
*d++ = *s; d[len] = '\0';
s++;
} }
if (d != NULL)
*d = '\0';
} }
*str = s;
if (*s == ',') { if (*s == ',') {
(*str)++; *str = s + 1;
return 2; return 2;
} }
*str = s;
return 1; return 1;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment