linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Gilad Ben-Yossef <gilad@benyossef.com>
Cc: kbuild-all@01.org, Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org, Binoy Jayan <binoy.jayan@linaro.org>,
	devicetree@vger.kernel.org, gilad.benyossef@arm.com,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	Stuart Yoder <stuart.yoder@arm.com>,
	Ofir Drang <ofir.drang@arm.com>
Subject: [PATCH] staging: ccree: fix ifnullfree.cocci warnings
Date: Fri, 21 Apr 2017 02:06:29 +0800	[thread overview]
Message-ID: <20170420180629.GA1954@lkp-ne04.lkp.intel.com> (raw)
In-Reply-To: <1492693983-8175-3-git-send-email-gilad@benyossef.com>

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 <gilad@benyossef.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 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, 

  reply	other threads:[~2017-04-20 18:07 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20 13:12 [PATCH v2 0/9] staging: ccree: add Arm TrustZone CryptoCell REE driver Gilad Ben-Yossef
2017-04-20 13:12 ` [PATCH v2 1/9] staging: ccree: introduce CryptoCell HW driver Gilad Ben-Yossef
2017-04-20 13:33   ` Greg Kroah-Hartman
2017-04-20 13:40     ` Gilad Ben-Yossef
2017-04-20 14:01       ` Greg Kroah-Hartman
2017-04-23  9:38         ` Gilad Ben-Yossef
2017-04-20 17:12   ` [PATCH] staging: ccree: fix platform_no_drv_owner.cocci warnings kbuild test robot
2017-04-20 17:12   ` [PATCH] staging: ccree: fix ifnullfree.cocci warnings kbuild test robot
2017-04-20 17:12   ` [PATCH v2 1/9] staging: ccree: introduce CryptoCell HW driver kbuild test robot
2017-04-20 17:12   ` [PATCH] staging: ccree: fix semicolon.cocci warnings kbuild test robot
2017-04-20 17:12   ` [PATCH] staging: ccree: fix array_size.cocci warnings kbuild test robot
2017-04-20 13:12 ` [PATCH v2 2/9] staging: ccree: add ahash support Gilad Ben-Yossef
2017-04-20 18:06   ` kbuild test robot [this message]
2017-04-20 18:06   ` kbuild test robot
2017-04-20 13:12 ` [PATCH v2 3/9] staging: ccree: add skcipher support Gilad Ben-Yossef
2017-04-20 13:12 ` [PATCH v2 4/9] staging: ccree: add IV generation support Gilad Ben-Yossef
2017-04-20 13:12 ` [PATCH v2 5/9] staging: ccree: add AEAD support Gilad Ben-Yossef
2017-04-20 18:57   ` kbuild test robot
2017-04-20 13:13 ` [PATCH v2 6/9] staging: ccree: add FIPS support Gilad Ben-Yossef
2017-04-20 13:39   ` Stephan Müller
2017-04-23  9:48     ` Gilad Ben-Yossef
2017-04-23 18:57       ` Stephan Müller
2017-04-24  6:06       ` Gilad Ben-Yossef
2017-04-24  6:16         ` Stephan Müller
2017-04-24  6:21           ` Stephan Müller
2017-04-24  7:07             ` Gilad Ben-Yossef
2017-04-24  7:23               ` Stephan Müller
2017-04-24  7:04           ` Gilad Ben-Yossef
2017-04-24  7:22             ` Stephan Müller
2017-04-20 13:13 ` [PATCH v2 7/9] staging: ccree: add TODO list Gilad Ben-Yossef
2017-04-20 13:13 ` [PATCH v2 8/9] staging: ccree: add DT bindings for Arm CryptoCell Gilad Ben-Yossef
2017-04-20 13:13 ` [PATCH v2 9/9] MAINTAINERS: add Gilad BY as ccree maintainer Gilad Ben-Yossef
2017-04-20 13:30 ` [PATCH v2 0/9] staging: ccree: add Arm TrustZone CryptoCell REE driver Greg Kroah-Hartman
2017-04-20 13:36   ` Gilad Ben-Yossef

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170420180629.GA1954@lkp-ne04.lkp.intel.com \
    --to=lkp@intel.com \
    --cc=binoy.jayan@linaro.org \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gilad.benyossef@arm.com \
    --cc=gilad@benyossef.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=kbuild-all@01.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=ofir.drang@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=stuart.yoder@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).