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>
This commit is contained in:
parent
de8288b1f8
commit
0049f26ae0
|
@ -565,19 +565,12 @@ static int kallsyms_open(struct inode *inode, struct file *file)
|
||||||
* using get_symbol_offset for every symbol.
|
* using get_symbol_offset for every symbol.
|
||||||
*/
|
*/
|
||||||
struct kallsym_iter *iter;
|
struct kallsym_iter *iter;
|
||||||
int ret;
|
iter = __seq_open_private(file, &kallsyms_op, sizeof(*iter));
|
||||||
|
|
||||||
iter = kmalloc(sizeof(*iter), GFP_KERNEL);
|
|
||||||
if (!iter)
|
if (!iter)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
reset_iter(iter, 0);
|
reset_iter(iter, 0);
|
||||||
|
|
||||||
ret = seq_open(file, &kallsyms_op);
|
return 0;
|
||||||
if (ret == 0)
|
|
||||||
((struct seq_file *)file->private_data)->private = iter;
|
|
||||||
else
|
|
||||||
kfree(iter);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_KGDB_KDB
|
#ifdef CONFIG_KGDB_KDB
|
||||||
|
|
Loading…
Reference in New Issue