Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933236AbdCKHQQ (ORCPT ); Sat, 11 Mar 2017 02:16:16 -0500 Received: from mga01.intel.com ([192.55.52.88]:16554 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755628AbdCKHPy (ORCPT ); Sat, 11 Mar 2017 02:15:54 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,145,1486454400"; d="scan'208";a="234830195" Date: Sat, 11 Mar 2017 15:15:21 +0800 From: kbuild test robot To: Romain Perier Cc: kbuild-all@01.org, Dan Williams , Doug Ledford , Sean Hefty , Hal Rosenstock , jeffrey.t.kirsher@intel.com, "David S. Miller" , stas.yakovlev@gmail.com, "James E.J. Bottomley" , "Martin K. Petersen" , Felipe Balbi , Greg Kroah-Hartman , linux-rdma@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Romain Perier , Peter Senna Tschudin Subject: [PATCH] block: DAC960: fix ifnullfree.cocci warnings Message-ID: <20170311071521.GA16525@lkp-wsm-ep1> References: <201703111417.0LzAlMy8%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170308161957.28941-2-romain.perier@collabora.com> 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 Content-Length: 1469 Lines: 36 drivers/block/DAC960.c:441:3-19: 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. drivers/block/DAC960.c:446:1-17: 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 CC: Romain Perier Signed-off-by: Fengguang Wu --- DAC960.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c @@ -437,13 +437,11 @@ static void DAC960_DestroyAuxiliaryStruc Controller->CurrentStatusBuffer = NULL; } - if (ScatterGatherPool != NULL) - dma_pool_destroy(ScatterGatherPool); + dma_pool_destroy(ScatterGatherPool); if (Controller->FirmwareType == DAC960_V1_Controller) return; - if (RequestSensePool != NULL) - dma_pool_destroy(RequestSensePool); + dma_pool_destroy(RequestSensePool); for (i = 0; i < DAC960_MaxLogicalDrives; i++) { kfree(Controller->V2.LogicalDeviceInformation[i]);