From patchwork Tue Feb 14 15:24:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 57075 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3040375wrn; Tue, 14 Feb 2023 07:26:21 -0800 (PST) X-Google-Smtp-Source: AK7set+xYzacAxLqpk+XwZ0MHj2rXeo0mrAguwGzZlxjc60JsRUhEnppm+SImpcYKw0whqPDAOCr X-Received: by 2002:a17:906:26d7:b0:8af:38cf:bb7f with SMTP id u23-20020a17090626d700b008af38cfbb7fmr2962898ejc.51.1676388381207; Tue, 14 Feb 2023 07:26:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676388381; cv=none; d=google.com; s=arc-20160816; b=OlhH8Jzci4cMO5r+wTvM2F1Rlqvfemq3AiqjT9QsbLrUDPzA9ePC1nYcaUOfHbn0HB XsA1czRQmrWtZdbJt/6LthCY9XyDuBmLZiK7+AtBzoaSgs5SbjmGAsam/61nDIv+sNmU 6uuHU1ZK7njOkjS9GnAnDh08Hi0BGKAmyudyBelnlkCh8SJdcbCsJ8HOUJnNGE4XSFe6 IkeM+LOorWcTgtFe37/E+IKs0PQzH/wSaZHH47PfN4d+WaxY1H4HS+4c0QT1RY4gwydN oJvrqCLhmRHE2vwcH/Azcu9J/N0fVEzjDVPJmN5YrmthIFsGCEs8Zsnl8U/XOZ/rJlZ1 iYzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject:dkim-signature; bh=7Xc+RSQFcnWbUxwq11nYIVRTMsilXA2b1xzlNTwt8Bs=; b=0AegDY5+itDkJcQ6zzWs8NEAsf18+aU7VO8uV1XU3G5i2o3fHYdX7RuCsPpVjxkcN8 pGJl6MzP9gsnCyo6R+DOQLYn8+ZOVpkUpwUCDE8q0bD5+4MODmxC/sHAvTl4hbS4gd/h Nq2lll6J12TPjIh0cWqe41mGukScZHBRITAqBRuXWubMJWyHfMES8a1+jEUPwT2a2sJZ Mkb/bgHMQjM95LfphusKfovMEmmX+2P1853IcvYeOF3zVodYkvg5NL2NCOkcNDL0pgo+ ZmVlaEJ8htoY7Y7GemMrejlSLD8xsax5PZxo4nn9F5a5o5DJ0b9P9iVoJcPqW86oGkKq 0f+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sNgjTCAi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o5-20020aa7d3c5000000b004acd2bd34c0si4595490edr.46.2023.02.14.07.25.58; Tue, 14 Feb 2023 07:26:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sNgjTCAi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233548AbjBNPY5 (ORCPT + 99 others); Tue, 14 Feb 2023 10:24:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233528AbjBNPYq (ORCPT ); Tue, 14 Feb 2023 10:24:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35E062B60B; Tue, 14 Feb 2023 07:24:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DBA62B81BFA; Tue, 14 Feb 2023 15:24:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AC0FC433EF; Tue, 14 Feb 2023 15:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676388275; bh=hHNCMMKRLHJy05248W2d4GXueax2ArtVMUz/DS2OwBg=; h=Subject:From:To:Cc:Date:From; b=sNgjTCAivxJNVxtja0NXdz8pVXMqA82EZ1P4KOSzgibVwKwNzPsPQZ1+RtDGREZuz 9B4dWcj7FApYwVAngCp6uNlRjlrel11dAd5NfH1bo3AHvtkaHI8mcmyKMV3NZujm+J NMhffC2lBHKfMtJYJIqujR5vrB3fih/QR9441YgaDvcEAZvbXa5eWeIErh9/fBWdbw JHmUogSfh5AkAXF2PW1+ZUaIeV+nLQkqjZkUg7r2FhovkYdtWYgXvOJmNZQOTMofKV 5wgJRlK7oHLgLXXNZmbTQkqyVJV0J86oEoK3xc3Q67nov6tSwQLor8nGdXnfJz4bJj q2jj7ECxpjh3A== Subject: [PATCH] NFSD: Clean up nfsd_symlink() From: Chuck Lever To: colin.i.king@gmail.com, error27@gmail.com Cc: jlayton@redhat.com, linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 14 Feb 2023 10:24:34 -0500 Message-ID: <167638827427.6570.12643671133126504826.stgit@bazille.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757820623499572986?= X-GMAIL-MSGID: =?utf-8?q?1757820623499572986?= From: Chuck Lever The pointer dentry is assigned a value that is never read, the assignment is redundant and can be removed. Cleans up clang-scan warning: fs/nfsd/nfsctl.c:1231:2: warning: Value stored to 'dentry' is never read [deadcode.DeadStores] dentry = ERR_PTR(ret); No need to initialize "int ret = -ENOMEM;" either. These are vestiges of nfsd_mkdir(), from whence I copied nfsd_symlink(). Reported-by: Colin Ian King Reported-by: Dan Carpenter Signed-off-by: Chuck Lever --- fs/nfsd/nfsctl.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 04474b8ccf0a..7b8f17ee5224 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1214,22 +1214,17 @@ static void nfsd_symlink(struct dentry *parent, const char *name, { struct inode *dir = parent->d_inode; struct dentry *dentry; - int ret = -ENOMEM; + int ret; inode_lock(dir); dentry = d_alloc_name(parent, name); if (!dentry) - goto out_err; + goto out; ret = __nfsd_symlink(d_inode(parent), dentry, S_IFLNK | 0777, content); if (ret) - goto out_err; + dput(dentry); out: inode_unlock(dir); - return; -out_err: - dput(dentry); - dentry = ERR_PTR(ret); - goto out; } #else static inline void nfsd_symlink(struct dentry *parent, const char *name,