Skip to content

Commit ce34fdd

Browse files
oleg-nesterovtorvalds
authored andcommitted
fs/proc/task_nommu.c: change maps_open() to use __seq_open_private()
Cleanup and preparation. maps_open() can use __seq_open_private() like proc_maps_open() does. [akpm@linux-foundation.org: deuglify] Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 557c2d8 commit ce34fdd

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

‎fs/proc/task_nommu.c‎

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -269,20 +269,13 @@ static int maps_open(struct inode *inode, struct file *file,
269269
const struct seq_operations *ops)
270270
{
271271
struct proc_maps_private *priv;
272-
int ret = -ENOMEM;
273-
274-
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
275-
if (priv) {
276-
priv->pid = proc_pid(inode);
277-
ret = seq_open(file, ops);
278-
if (!ret) {
279-
struct seq_file *m = file->private_data;
280-
m->private = priv;
281-
} else {
282-
kfree(priv);
283-
}
284-
}
285-
return ret;
272+
273+
priv = __seq_open_private(file, ops, sizeof(struct proc_maps_private));
274+
if (!priv)
275+
return -ENOMEM;
276+
277+
priv->pid = proc_pid(inode);
278+
return 0;
286279
}
287280

288281
static int pid_maps_open(struct inode *inode, struct file *file)

0 commit comments

Comments
 (0)