Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752695AbdGYPlK (ORCPT ); Tue, 25 Jul 2017 11:41:10 -0400 Received: from mga01.intel.com ([192.55.52.88]:60466 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752156AbdGYPlG (ORCPT ); Tue, 25 Jul 2017 11:41:06 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,411,1496127600"; d="scan'208";a="882645359" Date: Tue, 25 Jul 2017 23:40:05 +0800 From: kbuild test robot To: Romain Perier Cc: kbuild-all@01.org, "Martin K. Petersen" , Peter Senna Tschudin , Kashyap Desai , Sumit Saxena , Shivasharan S , "James E.J. Bottomley" , megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: megaraid: fix ifnullfree.cocci warnings Message-ID: <20170725154005.GA50912@lkp-hsx03.lkp.intel.com> References: <201707252301.SY4YDAmp%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201707252301.SY4YDAmp%fengguang.wu@intel.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: 1714 Lines: 41 drivers/scsi/megaraid/megaraid_sas_fusion.c:608:2-18: 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/scsi/megaraid/megaraid_sas_fusion.c:629:2-18: 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: cbb80044a6c7 ("scsi: megaraid: Replace PCI pool old API") CC: Romain Perier Signed-off-by: Fengguang Wu --- megaraid_sas_fusion.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -604,8 +604,7 @@ megasas_free_rdpq_fusion(struct megasas_ fusion->reply_frames_desc_phys[i]); } - if (fusion->reply_frames_desc_pool) - dma_pool_destroy(fusion->reply_frames_desc_pool); + dma_pool_destroy(fusion->reply_frames_desc_pool); if (fusion->rdpq_virt) pci_free_consistent(instance->pdev, @@ -625,8 +624,7 @@ megasas_free_reply_fusion(struct megasas fusion->reply_frames_desc[0], fusion->reply_frames_desc_phys[0]); - if (fusion->reply_frames_desc_pool) - dma_pool_destroy(fusion->reply_frames_desc_pool); + dma_pool_destroy(fusion->reply_frames_desc_pool); }