From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f66.google.com ([209.85.208.66]:41126 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725886AbeHRQca (ORCPT ); Sat, 18 Aug 2018 12:32:30 -0400 Received: by mail-ed1-f66.google.com with SMTP id s24-v6so5977782edr.8 for ; Sat, 18 Aug 2018 06:24:47 -0700 (PDT) From: Rasmus Villemoes To: Alexey Dobriyan Cc: linux-kernel@vger.kernel.org, Rasmus Villemoes , linux-fsdevel@vger.kernel.org Subject: [PATCH v2 4/8] proc: use seq_open_data() in proc_id_map_open() Date: Sat, 18 Aug 2018 15:24:30 +0200 Message-Id: <20180818132434.9515-4-linux@rasmusvillemoes.dk> In-Reply-To: <20180818132434.9515-1-linux@rasmusvillemoes.dk> References: <20180818132434.9515-1-linux@rasmusvillemoes.dk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Simplify the code slightly by using the seq_open_data helper. Signed-off-by: Rasmus Villemoes --- Depends on 1/8 introducing seq_open_data. fs/proc/base.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index aaffc0c30216..32ed72c44412 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2747,7 +2747,6 @@ static int proc_id_map_open(struct inode *inode, struct file *file, { struct user_namespace *ns = NULL; struct task_struct *task; - struct seq_file *seq; int ret = -EINVAL; task = get_proc_task(inode); @@ -2758,19 +2757,11 @@ static int proc_id_map_open(struct inode *inode, struct file *file, put_task_struct(task); } if (!ns) - goto err; + return ret; - ret = seq_open(file, seq_ops); + ret = seq_open_data(file, seq_ops, ns); if (ret) - goto err_put_ns; - - seq = file->private_data; - seq->private = ns; - - return 0; -err_put_ns: - put_user_ns(ns); -err: + put_user_ns(ns); return ret; } -- 2.16.4