Skip to content

Commit

Permalink
kernel/kallsyms.c: use __seq_open_private()
Browse files Browse the repository at this point in the history
Reduce boilerplate code by using __seq_open_private() instead of
seq_open() in kallsyms_open().

Signed-off-by: Rob Jones <[email protected]>
Cc: Gideon Israel Dsouza <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Rob Jones authored and torvalds committed Oct 14, 2014
1 parent de8288b commit 0049f26
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions kernel/kallsyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0049f26

Please sign in to comment.