From: kbuild test robot Subject: [PATCH] drivers: crypto: fix ifnullfree.cocci warnings Date: Thu, 12 Jan 2017 21:38:58 +0800 Message-ID: <20170112133857.GA56852@cairo.lkp.intel.com> References: <201701122154.qOAETU7M%fengguang.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kbuild-all@01.org, herbert@gondor.apana.org.au, davem@davemloft.net, david.daney@cavium.com, clabbe.montjoie@gmail.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, George Cherian To: George Cherian Return-path: Received: from mga11.intel.com ([192.55.52.93]:28201 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750777AbdALNjh (ORCPT ); Thu, 12 Jan 2017 08:39:37 -0500 Content-Disposition: inline In-Reply-To: <1484132211-917-4-git-send-email-george.cherian@cavium.com> Sender: linux-crypto-owner@vger.kernel.org List-ID: drivers/crypto/cavium/cpt/cptvf_reqmanager.c:312:2-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/crypto/cavium/cpt/cptvf_reqmanager.c:315:2-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/crypto/cavium/cpt/cptvf_reqmanager.c:318:2-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/crypto/cavium/cpt/cptvf_reqmanager.c:321:2-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. 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: George Cherian Signed-off-by: Fengguang Wu --- cptvf_reqmanager.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) --- a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c +++ b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c @@ -308,17 +308,13 @@ void do_request_cleanup(struct cpt_vf *c } } - if (info->scatter_components) - kzfree(info->scatter_components); + kzfree(info->scatter_components); - if (info->gather_components) - kzfree(info->gather_components); + kzfree(info->gather_components); - if (info->out_buffer) - kzfree(info->out_buffer); + kzfree(info->out_buffer); - if (info->in_buffer) - kzfree(info->in_buffer); + kzfree(info->in_buffer); if (info->completion_addr) kzfree((void *)info->completion_addr);