From patchwork Thu Apr 20 18:06:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kernel test robot X-Patchwork-Id: 9691087 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 512276037F for ; Thu, 20 Apr 2017 18:07:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 497BD2847A for ; Thu, 20 Apr 2017 18:07:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CA8B284DB; Thu, 20 Apr 2017 18:07:42 +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=unavailable 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 D805C2847A for ; Thu, 20 Apr 2017 18:07:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032088AbdDTSHZ (ORCPT ); Thu, 20 Apr 2017 14:07:25 -0400 Received: from mga06.intel.com ([134.134.136.31]:53681 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968162AbdDTSHW (ORCPT ); Thu, 20 Apr 2017 14:07:22 -0400 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP; 20 Apr 2017 11:07:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,225,1488873600"; d="scan'208";a="90299358" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by orsmga005.jf.intel.com with ESMTP; 20 Apr 2017 11:07:19 -0700 Received: from kbuild by bee with local (Exim 4.84_2) (envelope-from ) id 1d1GW0-0000qu-Dm; Fri, 21 Apr 2017 02:09:12 +0800 Date: Fri, 21 Apr 2017 02:06:29 +0800 From: kbuild test robot To: Gilad Ben-Yossef Cc: kbuild-all@01.org, Herbert Xu , "David S. Miller" , Rob Herring , Mark Rutland , Greg Kroah-Hartman , devel@driverdev.osuosl.org, Binoy Jayan , devicetree@vger.kernel.org, gilad.benyossef@arm.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Stuart Yoder , Ofir Drang Subject: [PATCH] staging: ccree: fix ifnullfree.cocci warnings Message-ID: <20170420180629.GA1954@lkp-ne04.lkp.intel.com> References: <201704210146.3krxPlST%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1492693983-8175-3-git-send-email-gilad@benyossef.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-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP drivers/staging/ccree/ssi_hash.c:317: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. drivers/staging/ccree/ssi_hash.c:320: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. drivers/staging/ccree/ssi_hash.c:323: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. drivers/staging/ccree/ssi_hash.c:373: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. drivers/staging/ccree/ssi_hash.c:375: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. drivers/staging/ccree/ssi_hash.c:377: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. drivers/staging/ccree/ssi_hash.c:379:3-8: 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/staging/ccree/ssi_hash.c:381: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. drivers/staging/ccree/ssi_hash.c:383: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 CC: Gilad Ben-Yossef Signed-off-by: Fengguang Wu --- ssi_hash.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -313,14 +313,11 @@ fail4: state->digest_buff_dma_addr = 0; } fail3: - if (state->opad_digest_buff != NULL) - kfree(state->opad_digest_buff); + kfree(state->opad_digest_buff); fail2: - if (state->digest_bytes_len != NULL) - kfree(state->digest_bytes_len); + kfree(state->digest_bytes_len); fail1: - if (state->digest_buff != NULL) - kfree(state->digest_buff); + kfree(state->digest_buff); fail_digest_result_buff: if (state->digest_result_buff != NULL) { kfree(state->digest_result_buff); @@ -369,18 +366,12 @@ static void ssi_hash_unmap_request(struc state->opad_digest_dma_addr = 0; } - if (state->opad_digest_buff != NULL) - kfree(state->opad_digest_buff); - if (state->digest_bytes_len != NULL) - kfree(state->digest_bytes_len); - if (state->digest_buff != NULL) - kfree(state->digest_buff); - if (state->digest_result_buff != NULL) - kfree(state->digest_result_buff); - if (state->buff1 != NULL) - kfree(state->buff1); - if (state->buff0 != NULL) - kfree(state->buff0); + kfree(state->opad_digest_buff); + kfree(state->digest_bytes_len); + kfree(state->digest_buff); + kfree(state->digest_result_buff); + kfree(state->buff1); + kfree(state->buff0); } static void ssi_hash_unmap_result(struct device *dev,