From patchwork Sun Apr 10 15:57:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Juhl X-Patchwork-Id: 696641 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3AFummm021329 for ; Sun, 10 Apr 2011 15:56:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754297Ab1DJP4q (ORCPT ); Sun, 10 Apr 2011 11:56:46 -0400 Received: from swampdragon.chaosbits.net ([90.184.90.115]:10040 "EHLO swampdragon.chaosbits.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754138Ab1DJP4q (ORCPT ); Sun, 10 Apr 2011 11:56:46 -0400 Received: by swampdragon.chaosbits.net (Postfix, from userid 1000) id D90799403D; Sun, 10 Apr 2011 17:57:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by swampdragon.chaosbits.net (Postfix) with ESMTP id C76909403B; Sun, 10 Apr 2011 17:57:07 +0200 (CEST) Date: Sun, 10 Apr 2011 17:57:07 +0200 (CEST) From: Jesper Juhl To: Trond Myklebust cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] NFS: Remove dead code from nfs_fs_mount() Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 10 Apr 2011 15:56:48 +0000 (UTC) In fs/nfs/super.c::nfs_fs_mount() we test for a NULL 'data': ... if (data == NULL || mntfh == NULL) goto out_free_fh; ... and then further down in the function we test 'data' again: ... nfs_fscache_get_super_cookie( s, data ? data->fscache_uniq : NULL, NULL); ... this second check is just dead code since there is no way 'data' could possibly be NULL here. We also rely on a non-NULL 'data' in more than one location between these two tests, further proving the point that the second test is bogus. This patch removes the dead code. Signed-off-by: Jesper Juhl --- super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 2b8e9a5..685a8a7 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -2235,8 +2235,7 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type, if (!s->s_root) { /* initial superblock/root creation */ nfs_fill_super(s, data); - nfs_fscache_get_super_cookie( - s, data ? data->fscache_uniq : NULL, NULL); + nfs_fscache_get_super_cookie(s, data->fscache_uniq, NULL); } mntroot = nfs_get_root(s, mntfh, dev_name);