Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1500665imu; Wed, 23 Jan 2019 19:03:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Ax8hZ0DFKZROx6AtGOM70ngBDKMNGG4MF2+rJqOqvgDTJkZ0BZu2SauG7ieir9iHtKyZB X-Received: by 2002:a62:2702:: with SMTP id n2mr4776531pfn.29.1548298986449; Wed, 23 Jan 2019 19:03:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548298986; cv=none; d=google.com; s=arc-20160816; b=cinzIVl8kps42tMugwHqQ4aOoVV1buBwfp7EcT5jiYyYbpxLP02F+rfVqIXbtIeLK3 i8+/WVwuljWNCp8Rm3Xla2QdQpB8ykNtY3re+FNAZRLGFQ2FbdbHr2rwzPA/uaeCu3AP aLX92XIt8gaEk0zW2DOYp1KbZYBvuzxruV8eiaWJsKR6LD1+o2EVANju5iKhp+Y6J/UK 9ewx2Pjlfjc1NihQ3KUk+kldQ2klAJFauQznVejAfvu9somo5NHOd8iImMwkUp8gpcGW 3Z3+AN1H+CLqvQuUWhKSOzEDG29ewBPfI/BsFX20y3Frergfim1Op068g1zPNPnIU2en 1sAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=IaJQ7eO1K/bUq8q6dBi4FbMQSBpo7BA0SBNad/OSawM=; b=cvoJpYgwLmrIh3ErywziggqCt8IBUd3OFO/MIQh5+HD6jM3pM0WSw1bg++6mSOLGiT ma4wEMv3Xc6Wb/M0Frg3PWkZqNFqg6iPnDTpsDW6yZYhwERa9xIS6WsCtBkRm3PEb4iA YnrCNl8ZS3eyXp0uFz1hX3vdmWTvHoprk3CbGnM/Bw+3lmTgE22b+4+Qe+7xQGWB8pKA JcoNqlc3O7gC4CP+R0HGLI59o1GNB/ZfHWSjGBZ46n//JchsjY3PTQpcIVbMMGMRoZUT zdnIEO0QWjJODTQQMU5bT6B69kK2KKLygj8Gd2iIf9wo54MGoEWYOdlhCwXU6KiUM/TA U4LA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u22si16556318pgk.335.2019.01.23.19.02.50; Wed, 23 Jan 2019 19:03:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727222AbfAXDCi (ORCPT + 99 others); Wed, 23 Jan 2019 22:02:38 -0500 Received: from mout.gmx.net ([212.227.17.22]:60221 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbfAXDCi (ORCPT ); Wed, 23 Jan 2019 22:02:38 -0500 Received: from localhost.localdomain ([218.18.229.179]) by mail.gmx.com (mrgmx103 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MCL6r-1guzkI0aIr-0097nx; Thu, 24 Jan 2019 04:02:35 +0100 From: Chengguang Xu To: adobriyan@gmail.com, akpm@linux-foundation.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Chengguang Xu Subject: [PATCH 2/2] proc: code cleanup for proc_setup_thread_self() Date: Thu, 24 Jan 2019 11:01:50 +0800 Message-Id: <20190124030150.8472-2-cgxu519@gmx.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190124030150.8472-1-cgxu519@gmx.com> References: <20190124030150.8472-1-cgxu519@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:Gpau29f7AOcimbau3zLEJ0aZFY5WvThJ2/VStMTdj5lgB80KDSQ zHMmtErOQHtz3i59j7/RxrMLNMoviccssqWmRXezMnQMT0wx5wrGq5OhflpUH9vMyK48zRF dfLwNJEWXRRdtYBG+vTkM/0IWkW+XBSjGp7dSO9ssooKjXCvSr0zbYBuvs0hWYosT5kdi+e oYq1psl8Kjvqz1Y7/TE7w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:3rCGPSGjReI=:u8TvCPexPUVez+VdTLSBpV SUh4HlMnIaV49t9PRos0/Qlhn2K1sQSyC0ZGoI8n5WHzjr7akWvxkJsElQWjgMbpeZONlA8a7 SKIo+hNeCQNUJuht6uZQ+Ze3Vm2LsNjXo0OB9XILGzq715uTMP4oj3upHtInUr+cquZNI+P6J iieJ6BbNmegdUzBeenw124GaLm44sgRnzVFsHu22A0e270WIKeEKi+83T+eNms3rrGfsZXxGg QyYEuH00hPaB+VeQopS1DeP0ILGftH/lNHmEOIxV4mEr6nh6lFqy3kYpPxL/hnpI6HFrvp5Cy 7plDqBrbLCL1cjacXJX3Kupee+KcJxUCrFbleEfDrQYjaUEvdulSV18ic78jPovXvlcHR+7q/ 8VWD3WQdtV93IT1pSfAiqqexnvv4NUMGNJ8chbreLBO+790+fK0tUKSemyxEx8WEysePvReNc r70oNkvirI7uOVQ/IgN851ZpXanfJJiscHcHfPt6aL0wwFZOLvah1IgbYy/z1XjUuf9YOF2g4 V4cdfXANPmPvZSfhwX12H0lJ12bgEZF7XHzCKR7EgHRo9HH/2v5kJ18NPmQB9jVMaSz82cvEp BqThSL1gPfp57qQL0Zxst5A29SDV+r1tGgSzCgNS4B45mMfGXz9wrx3InTNJP6opGeImioTJb S84M0+xO9WHz4r7TW60/We/qkoOwqLt1/2pAUu9pgl7+FTERThfSNGaiJIEWIc9g7EfE8LF5y ToeBmvnGEgCfqS0QtMR3BggilbFPFyE3912992UupUKeeut7sYIlR2LFPSth+w3rdNZPERuSM ShS17BqHj/ep/NvBvdFiM+Q/LqKpXVlLInZDp4p093ZoTsSOJuMnHqzmjb2skWj2TtMHtDXsU Lyp+FcSwvND/0APcKsYxo775dTrzMEe6DaIfzJ9RIB/yIKnTdufbGi/tyjfPZA Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove unnecessary ERR_PTR()/PTR_ERR() cast in proc_setup_thread_self(). Signed-off-by: Chengguang Xu --- fs/proc/thread_self.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c index b905010ca9eb..f61ae53533f5 100644 --- a/fs/proc/thread_self.c +++ b/fs/proc/thread_self.c @@ -38,6 +38,7 @@ int proc_setup_thread_self(struct super_block *s) struct inode *root_inode = d_inode(s->s_root); struct pid_namespace *ns = proc_pid_ns(root_inode); struct dentry *thread_self; + int ret = -ENOMEM; inode_lock(root_inode); thread_self = d_alloc_name(s->s_root, "thread-self"); @@ -51,20 +52,19 @@ int proc_setup_thread_self(struct super_block *s) inode->i_gid = GLOBAL_ROOT_GID; inode->i_op = &proc_thread_self_inode_operations; d_add(thread_self, inode); + ret = 0; } else { dput(thread_self); - thread_self = ERR_PTR(-ENOMEM); } - } else { - thread_self = ERR_PTR(-ENOMEM); } inode_unlock(root_inode); - if (IS_ERR(thread_self)) { + + if (ret) pr_err("proc_fill_super: can't allocate /proc/thread_self\n"); - return PTR_ERR(thread_self); - } - ns->proc_thread_self = thread_self; - return 0; + else + ns->proc_thread_self = thread_self; + + return ret; } void __init proc_thread_self_init(void) -- 2.20.1