From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752822AbdLUJlZ (ORCPT ); Thu, 21 Dec 2017 04:41:25 -0500 Received: from mga05.intel.com ([192.55.52.43]:10402 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752553AbdLUJlF (ORCPT ); Thu, 21 Dec 2017 04:41:05 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,435,1508828400"; d="scan'208";a="14123473" Date: Thu, 21 Dec 2017 17:40:53 +0800 From: kbuild test robot To: NeilBrown Cc: kbuild-all@01.org, Oleg Drokin , Andreas Dilger , James Simmons , Greg Kroah-Hartman , lkml , lustre Subject: [PATCH] staging: lustre: fix ifnullfree.cocci warnings Message-ID: <20171221094052.GA9993@lkp-wsx02> References: <151355799030.6200.8100283223734974485.stgit@noble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <151355799030.6200.8100283223734974485.stgit@noble> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: fengguang.wu@intel.com X-SA-Exim-Scanned: No (on bee); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fengguang Wu drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:886:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. NULL check before some freeing functions is not needed. Based on checkpatch warning "kfree(NULL) is safe this check is probably not required" and kfreeaddr.cocci by Julia Lawall. Generated by: scripts/coccinelle/free/ifnullfree.cocci Fixes: 862af72835c1 ("staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc.") CC: NeilBrown Signed-off-by: Fengguang Wu --- o2iblnd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -882,8 +882,7 @@ void kiblnd_destroy_conn(struct kib_conn IBLND_RX_MSGS(conn) * sizeof(struct kib_rx)); } - if (conn->ibc_connvars) - kfree(conn->ibc_connvars); + kfree(conn->ibc_connvars); if (conn->ibc_hdev) kiblnd_hdev_decref(conn->ibc_hdev);