summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorRob Jones <rob.jones@codethink.co.uk>2014-10-14 00:52:10 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 02:18:16 +0200
commit0049f26ae0ad00016d8e237a6d712bff155cedc5 (patch)
tree1d6ea48be5b4fb749eab799ab804761dce8e1105 /kernel
parentbinfmt_misc: work around gcc-4.9 warning (diff)
downloadlinux-0049f26ae0ad00016d8e237a6d712bff155cedc5.tar.xz
linux-0049f26ae0ad00016d8e237a6d712bff155cedc5.zip
kernel/kallsyms.c: use __seq_open_private()
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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/kallsyms.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index ae5167087845..5c5987f10819 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -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