From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758376Ab3BMTo5 (ORCPT ); Wed, 13 Feb 2013 14:44:57 -0500 Received: from mail.tpi.com ([70.99.223.143]:1645 "EHLO mail.tpi.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755691Ab3BMTo4 (ORCPT ); Wed, 13 Feb 2013 14:44:56 -0500 From: Tim Gardner To: linux-kernel@vger.kernel.org Cc: Tim Gardner , Mark Fasheh , Joel Becker , ocfs2-devel@oss.oracle.com Subject: [PATCH 1/2 linux-next] ocfs2: remove kfree() redundant null checks Date: Wed, 13 Feb 2013 12:44:35 -0700 Message-Id: <1360784676-74994-1-git-send-email-tim.gardner@canonical.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org smatch analysis: fs/ocfs2/alloc.c:6138 ocfs2_begin_truncate_log_recovery() info: redundant null check on *tl_copy calling kfree() fs/ocfs2/alloc.c:6755 ocfs2_zero_range_for_truncate() info: redundant null check on pages calling kfree() Cc: Mark Fasheh Cc: Joel Becker Cc: ocfs2-devel@oss.oracle.com Signed-off-by: Tim Gardner --- fs/ocfs2/alloc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 31b9463..42c0e49 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c @@ -6134,11 +6134,8 @@ bail: iput(tl_inode); brelse(tl_bh); - if (status < 0 && (*tl_copy)) { - kfree(*tl_copy); - *tl_copy = NULL; - mlog_errno(status); - } + kfree(*tl_copy); + *tl_copy = NULL; return status; } @@ -6751,8 +6748,7 @@ int ocfs2_zero_range_for_truncate(struct inode *inode, handle_t *handle, mlog_errno(ret); out: - if (pages) - kfree(pages); + kfree(pages); return ret; } -- 1.7.9.5