Commit ce34fddb5bafb424a4aaa9f403feb7dbe776c7d1
Committed by
Linus Torvalds
1 parent
557c2d8a73
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
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>
Showing 1 changed file with 7 additions and 14 deletions Side-by-side Diff
fs/proc/task_nommu.c
... | ... | @@ -269,20 +269,13 @@ |
269 | 269 | const struct seq_operations *ops) |
270 | 270 | { |
271 | 271 | struct proc_maps_private *priv; |
272 | - int ret = -ENOMEM; | |
273 | 272 | |
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; | |
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; | |
286 | 279 | } |
287 | 280 | |
288 | 281 | static int pid_maps_open(struct inode *inode, struct file *file) |