From: Oleg Nesterov Date: Thu, 9 Oct 2014 22:25:45 +0000 (-0700) Subject: fs/proc/task_nommu.c: change maps_open() to use __seq_open_private() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ce34fddb5bafb424a4aaa9f403feb7dbe776c7d1;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Cc: Kirill A. Shutemov Cc: Cyrill Gorcunov Cc: "Eric W. Biederman" Acked-by: Greg Ungerer Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 678455d2d683..98c95d2833ea 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c @@ -269,20 +269,13 @@ static int maps_open(struct inode *inode, struct file *file, const struct seq_operations *ops) { struct proc_maps_private *priv; - int ret = -ENOMEM; - - priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (priv) { - priv->pid = proc_pid(inode); - ret = seq_open(file, ops); - if (!ret) { - struct seq_file *m = file->private_data; - m->private = priv; - } else { - kfree(priv); - } - } - return ret; + + priv = __seq_open_private(file, ops, sizeof(struct proc_maps_private)); + if (!priv) + return -ENOMEM; + + priv->pid = proc_pid(inode); + return 0; } static int pid_maps_open(struct inode *inode, struct file *file)