From patchwork Tue Jul 25 15:40:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengguang Wu X-Patchwork-Id: 9862341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DDD60600F5 for ; Tue, 25 Jul 2017 15:41:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C888B286CA for ; Tue, 25 Jul 2017 15:41:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC0C5286D4; Tue, 25 Jul 2017 15:41:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 417FA286C1 for ; Tue, 25 Jul 2017 15:41:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752464AbdGYPlH (ORCPT ); Tue, 25 Jul 2017 11:41:07 -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 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2017 08:41:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,411,1496127600"; d="scan'208";a="882645359" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by FMSMGA003.fm.intel.com with ESMTP; 25 Jul 2017 08:41:04 -0700 Received: from kbuild by bee with local (Exim 4.84_2) (envelope-from ) id 1da21a-000Q9m-9r; Tue, 25 Jul 2017 23:45:30 +0800 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-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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }