kernel/kallsyms.c: use __seq_open_private()
authorRob Jones <rob.jones@codethink.co.uk>
Mon, 13 Oct 2014 22:52:10 +0000 (15:52 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Oct 2014 00:18:16 +0000 (02:18 +0200)
Reduce boilerplate code by using __seq_open_private() instead of
seq_open() in kallsyms_open().

Signed-off-by: Rob Jones <rob.jones@codethink.co.uk>
Cc: Gideon Israel Dsouza <gidisrael@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/kallsyms.c

index ae51670878457d9b0db2498ee032d5735933e96f..5c5987f1081964109f96cd6cc52b285b948f0a9e 100644 (file)
@@ -565,19 +565,12 @@ static int kallsyms_open(struct inode *inode, struct file *file)
         * using get_symbol_offset for every symbol.
         */
        struct kallsym_iter *iter;
-       int ret;
-
-       iter = kmalloc(sizeof(*iter), GFP_KERNEL);
+       iter = __seq_open_private(file, &kallsyms_op, sizeof(*iter));
        if (!iter)
                return -ENOMEM;
        reset_iter(iter, 0);
 
-       ret = seq_open(file, &kallsyms_op);
-       if (ret == 0)
-               ((struct seq_file *)file->private_data)->private = iter;
-       else
-               kfree(iter);
-       return ret;
+       return 0;
 }
 
 #ifdef CONFIG_KGDB_KDB