From patchwork Fri Oct 12 17:59:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gao Xiang X-Patchwork-Id: 10639057 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C8E8112B for ; Fri, 12 Oct 2018 18:00:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E4A12C297 for ; Fri, 12 Oct 2018 18:00:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52A2A2C276; Fri, 12 Oct 2018 18:00:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D67012C244 for ; Fri, 12 Oct 2018 18:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727071AbeJMBeG (ORCPT ); Fri, 12 Oct 2018 21:34:06 -0400 Received: from sonic316-8.consmr.mail.gq1.yahoo.com ([98.137.69.32]:46150 "EHLO sonic316-8.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbeJMBeG (ORCPT ); Fri, 12 Oct 2018 21:34:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1539367224; bh=ZOcg8hBbbIYxmvjOTZg/CZt6vhIGoyhwB4ZhaV2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f0q3c3Btc0SWVG.S4Xc65Y1JUm0jd15d0W3cura52MUmWH0tZg1NT_1qj3laNbR5RkWqu Et8sxRTvBuUyZy6JmHYs5tc.QujZAlKHqEArREY0hq5NkHFhuxbHMXhvKWbtkJsyff78rNmJoJ.a Sb8tP9Xisx6fSt5JoAtcU4ClzBS0kdChdsV5SfC_INO.G2ywKJdHYfpi3L92_l0z1fuEjjAk.R36 Hl1kcCntJ_NZigVkoQYG94SHgE8xZU1r1KRZQiCKg8qwQ9iZ_tAFbwM6pYCXiCo6NDJ3q0jjUKGE T1dzZAs0LqU07.MgtCA9FuCqUgFJX07rU5pDD8wqXOIcj7wd_U5Y1NpJRYUuRuwRUxNmxER1q5f3 3NuGaaXioX8wO3g03AExJxhx__XeIaHeWrdU_FLs_xEO7KWzI0wHzEM6QoTUcFDkCwzKhotA- Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.gq1.yahoo.com with HTTP; Fri, 12 Oct 2018 18:00:24 +0000 Received: from 183.156.49.100 (EHLO localhost.localdomain) ([183.156.49.100]) by smtp406.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID ed195a26657336ad6610d1a74a356e02; Fri, 12 Oct 2018 18:00:22 +0000 (UTC) From: Gao Xiang To: Greg Kroah-Hartman , devel@driverdev.osuosl.org Cc: LKML , linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, Chao Yu , Chao Yu , Miao Xie , Al Viro Subject: [PATCH RESEND] staging: erofs: clean erofs_lookup() Date: Sat, 13 Oct 2018 01:59:49 +0800 Message-Id: <1539367189-20186-1-git-send-email-hsiangkao@aol.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Al Viro d_splice_alias() does the right thing when given ERR_PTR(-E...) for inode. No need for gotos, multiple returns, etc. in there. Signed-off-by: Al Viro Reviewed-by: Gao Xiang Signed-off-by: Gao Xiang --- Hi, Frankly, I think it is a straight-forward cleanup by Al enough to be submitted to Linux 4.20 in constant to other pending fixes found in the process of EROFS productization these days, which I need more time to think over and fix formally to the community. p.s. I have no idea whether this patch has been already queued up in Al's fs tree for 4.20... :'( +Cc Greg / the staging mailing list as well. Or please ignore this email... Thanks, Gao Xiang drivers/staging/erofs/namei.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/staging/erofs/namei.c b/drivers/staging/erofs/namei.c index 0039b76..5596c52 100644 --- a/drivers/staging/erofs/namei.c +++ b/drivers/staging/erofs/namei.c @@ -223,18 +223,13 @@ static struct dentry *erofs_lookup(struct inode *dir, if (err == -ENOENT) { /* negative dentry */ inode = NULL; - goto negative_out; - } else if (unlikely(err)) - return ERR_PTR(err); - - debugln("%s, %s (nid %llu) found, d_type %u", __func__, - dentry->d_name.name, nid, d_type); - - inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR); - if (IS_ERR(inode)) - return ERR_CAST(inode); - -negative_out: + } else if (unlikely(err)) { + inode = ERR_PTR(err); + } else { + debugln("%s, %s (nid %llu) found, d_type %u", __func__, + dentry->d_name.name, nid, d_type); + inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR); + } return d_splice_alias(inode, dentry); }