From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935488AbYDQJ4y (ORCPT ); Thu, 17 Apr 2008 05:56:54 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933773AbYDQJ05 (ORCPT ); Thu, 17 Apr 2008 05:26:57 -0400 Received: from mx1.redhat.com ([66.187.233.31]:46268 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760997AbYDQJ0y (ORCPT ); Thu, 17 Apr 2008 05:26:54 -0400 From: swhiteho@redhat.com To: linux-kernel@vger.kernel.org, cluster-devel@redhat.com Cc: Julia Lawall , Steven Whitehouse Subject: [PATCH 47/48] [GFS2] test for IS_ERR rather than 0 Date: Thu, 17 Apr 2008 09:39:23 +0100 Message-Id: <12084216662161-git-send-email-swhiteho@redhat.com> X-Mailer: git-send-email 1.5.1.2 In-Reply-To: <12084216641014-git-send-email-swhiteho@redhat.com> References: 12084214272083-git-send-email-swhiteho@redhat.com <12084215642582-git-send-email-swhiteho@redhat.com> <1208421571478-git-send-email-swhiteho@redhat.com> <12084215742081-git-send-email-swhiteho@redhat.com> <12084215763647-git-send-email-swhiteho@redhat.com> <12084215781246-git-send-email-swhiteho@redhat.com> <12084215802470-git-send-email-swhiteho@redhat.com> <12084215833555-git-send-email-swhiteho@redhat.com> <12084215851158-git-send-email-swhiteho@redhat.com> <120842158797-git-send-email-swhiteho@redhat.com> <12084215891940-git-send-email-swhiteho@redhat.com> <12084215913125-git-send-email-swhiteho@redhat.com> <12084215931509-git-send-email-swhiteho@redhat.com> <12084215961690-git-send-email-swhiteho@redhat.com> <1208421597980-git-send-email-swhiteho@redhat.com> <12084216003676-git-send-email-swhiteho@redhat.com> <12084216023999-git-send-email-swhiteho@redhat.com> <12084216044123-git-send-email-swhiteho@redhat.com> <12084216061172-git-send-email-swhiteho@redhat.com> <12084216082638-git-send-email-swhiteho@redhat.com> <12084216101961-git-send-email-swhiteho@redhat.com> <12084216121811-git-send-email-swhiteho@redhat.com> <12084216153016-git-send-email-swhiteho@redhat.com> <1208421617421-git-send-email-swhiteho@redhat.com> <12084216182363-git-send-email-swhiteho@redhat.com> <12084216204027-git-send-email-swhiteho@redhat.com> <12084216222853-git-send-email-swhiteho@redhat.com> <12084216241802-git-send-email-swhiteho@redhat.com> <12084216262937-git-send-email-swhiteho@redhat.com> <12084216281152-git-send-email-swhiteho@redhat.com> <12084216301107-git-send-email-swhiteho@redhat.com> <12084216323165-git-send-email-swhiteho@redhat.com> <1208421634101-git-send-email-swhiteho@redhat.com> <12084216372363-git-send-email-swhiteho@redhat.com> <12084216391215-git-send-email-swhiteho@redhat.com> <12084216402644-git-send-email-swhiteho@redhat.com> <12084216431261-git-send-email-swhiteho@redhat.com> <1208421645785-git-send-email-swhiteho@redhat.com> <1208421647805-git-send-email-swhiteho@redhat.com> <12084216494161-git-send-email-swhiteho@redhat.com> <12084216511207-git-send-email-swhiteho@redhat.com> <12084216533319-git-send-email-swhiteho@redhat.com> <12084216553542-git-send-email-swhiteho@redhat.com> <1208421657826-git-send-email-swhiteho@redhat.com> <12084216593910-git-send-email-swhiteho@redhat.com> <12084216611008-git-send-email-swhiteho@redhat.com> <12084216641014-git-send-email-swhiteho@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julia Lawall The function gfs2_inode_lookup always returns either a valid pointer or a value made with ERR_PTR, so its result should be tested with IS_ERR, not with a test for 0. The problem was found using the following semantic match. (http://www.emn.fr/x-info/coccinelle/) // @a@ expression E, E1; statement S,S1; position p; @@ E = gfs2_inode_lookup(...) ... when != E = E1 if@p (E) S else S1 @n@ position a.p; expression E,E1; statement S,S1; @@ E = NULL ... when != E = E1 if@p (E) S else S1 @depends on !n@ expression E; statement S,S1; position a.p; @@ * if@p (E) S else S1 // Signed-off-by: Julia Lawall Signed-off-by: Steven Whitehouse diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c index 334c7f8..990d9f4 100644 --- a/fs/gfs2/ops_export.c +++ b/fs/gfs2/ops_export.c @@ -204,8 +204,6 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, inode = gfs2_inode_lookup(sb, DT_UNKNOWN, inum->no_addr, 0, 0); - if (!inode) - goto fail; if (IS_ERR(inode)) { error = PTR_ERR(inode); goto fail; -- 1.5.1.2