aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/core.h2
-rw-r--r--sound/core/memory.c14
-rw-r--r--sound/pci/ali5451/ali5451.c2
3 files changed, 13 insertions, 5 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index f72b3ef515e2..3dc41fd5c54d 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -291,12 +291,14 @@ void snd_memory_done(void);
291int snd_memory_info_init(void); 291int snd_memory_info_init(void);
292int snd_memory_info_done(void); 292int snd_memory_info_done(void);
293void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags); 293void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags);
294void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags);
294void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags); 295void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags);
295void snd_hidden_kfree(const void *obj); 296void snd_hidden_kfree(const void *obj);
296void *snd_hidden_vmalloc(unsigned long size); 297void *snd_hidden_vmalloc(unsigned long size);
297void snd_hidden_vfree(void *obj); 298void snd_hidden_vfree(void *obj);
298char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags); 299char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags);
299#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) 300#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
301#define kzalloc(size, flags) snd_hidden_kzalloc(size, flags)
300#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) 302#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
301#define kfree(obj) snd_hidden_kfree(obj) 303#define kfree(obj) snd_hidden_kfree(obj)
302#define vmalloc(size) snd_hidden_vmalloc(size) 304#define vmalloc(size) snd_hidden_vmalloc(size)
diff --git a/sound/core/memory.c b/sound/core/memory.c
index 1622893d00a2..291b4769bde3 100644
--- a/sound/core/memory.c
+++ b/sound/core/memory.c
@@ -116,15 +116,21 @@ void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags)
116 return _snd_kmalloc(size, flags); 116 return _snd_kmalloc(size, flags);
117} 117}
118 118
119void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags)
120{
121 void *ret = _snd_kmalloc(size, flags);
122 if (ret)
123 memset(ret, 0, size);
124 return ret;
125}
126EXPORT_SYMBOL(snd_hidden_kzalloc);
127
119void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags) 128void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags)
120{ 129{
121 void *ret = NULL; 130 void *ret = NULL;
122 if (n != 0 && size > INT_MAX / n) 131 if (n != 0 && size > INT_MAX / n)
123 return ret; 132 return ret;
124 ret = _snd_kmalloc(n * size, flags); 133 return snd_hidden_kzalloc(n * size, flags);
125 if (ret)
126 memset(ret, 0, n * size);
127 return ret;
128} 134}
129 135
130void snd_hidden_kfree(const void *obj) 136void snd_hidden_kfree(const void *obj)
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index ce6c9fadb594..4943299cf137 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2249,7 +2249,7 @@ static int __devinit snd_ali_create(snd_card_t * card,
2249 return -ENXIO; 2249 return -ENXIO;
2250 } 2250 }
2251 2251
2252 if ((codec = kcalloc(1, sizeof(*codec), GFP_KERNEL)) == NULL) { 2252 if ((codec = kzalloc(sizeof(*codec), GFP_KERNEL)) == NULL) {
2253 pci_disable_device(pci); 2253 pci_disable_device(pci);
2254 return -ENOMEM; 2254 return -ENOMEM;
2255 } 2255 }