ALSA: info - Use krealloc()
[pandora-kernel.git] / sound / core / info.c
index 70fa871..3d1f513 100644 (file)
@@ -88,12 +88,10 @@ static int resize_info_buffer(struct snd_info_buffer *buffer,
        char *nbuf;
 
        nsize = PAGE_ALIGN(nsize);
-       nbuf = kmalloc(nsize, GFP_KERNEL);
+       nbuf = krealloc(buffer->buffer, nsize, GFP_KERNEL);
        if (! nbuf)
                return -ENOMEM;
 
-       memcpy(nbuf, buffer->buffer, buffer->len);
-       kfree(buffer->buffer);
        buffer->buffer = nbuf;
        buffer->len = nsize;
        return 0;
@@ -154,11 +152,6 @@ EXPORT_SYMBOL(snd_seq_root);
 struct snd_info_entry *snd_oss_root;
 #endif
 
-static inline void snd_info_entry_prepare(struct proc_dir_entry *de)
-{
-       de->owner = THIS_MODULE;
-}
-
 static void snd_remove_proc_entry(struct proc_dir_entry *parent,
                                  struct proc_dir_entry *de)
 {
@@ -522,32 +515,11 @@ static const struct file_operations snd_info_entry_operations =
        .release =              snd_info_entry_release,
 };
 
-/**
- * snd_create_proc_entry - create a procfs entry
- * @name: the name of the proc file
- * @mode: the file permission bits, S_Ixxx
- * @parent: the parent proc-directory entry
- *
- * Creates a new proc file entry with the given name and permission
- * on the given directory.
- *
- * Returns the pointer of new instance or NULL on failure.
- */
-static struct proc_dir_entry *snd_create_proc_entry(const char *name, mode_t mode,
-                                                   struct proc_dir_entry *parent)
-{
-       struct proc_dir_entry *p;
-       p = create_proc_entry(name, mode, parent);
-       if (p)
-               snd_info_entry_prepare(p);
-       return p;
-}
-
 int __init snd_info_init(void)
 {
        struct proc_dir_entry *p;
 
-       p = snd_create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL);
+       p = create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL);
        if (p == NULL)
                return -ENOMEM;
        snd_proc_root = p;
@@ -974,12 +946,11 @@ int snd_info_register(struct snd_info_entry * entry)
                return -ENXIO;
        root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
        mutex_lock(&info_mutex);
-       p = snd_create_proc_entry(entry->name, entry->mode, root);
+       p = create_proc_entry(entry->name, entry->mode, root);
        if (!p) {
                mutex_unlock(&info_mutex);
                return -ENOMEM;
        }
-       p->owner = entry->module;
        if (!S_ISDIR(entry->mode))
                p->proc_fops = &snd_info_entry_operations;
        p->size = entry->size;