Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933624AbcKVOtt (ORCPT ); Tue, 22 Nov 2016 09:49:49 -0500 Received: from mga09.intel.com ([134.134.136.24]:23081 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932949AbcKVOts (ORCPT ); Tue, 22 Nov 2016 09:49:48 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,533,1473145200"; d="scan'208";a="7938908" Date: Tue, 22 Nov 2016 22:48:44 +0800 From: kbuild test robot To: Ganesh Mahendran Cc: kbuild-all@01.org, gregkh@linuxfoundation.org, arve@android.com, riandrews@android.com, linux-kernel@vger.kernel.org, Ganesh Mahendran Subject: [PATCH] binder: fix ifnullfree.cocci warnings Message-ID: <20161122144844.GA70639@roam.lkp.intel.com> References: <201611222213.YdtKcd6v%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1479813450-4462-1-git-send-email-opensource.ganesh@gmail.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: 3146 Lines: 59 drivers/android/binder.c:3705:2-20: 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/android/binder.c:3708:2-20: 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/android/binder.c:3711:2-20: 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/android/binder.c:3714:2-20: 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/android/binder.c:3717:2-20: 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/android/binder.c:3720:2-20: 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/android/binder.c:3723:2-20: 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: Ganesh Mahendran Signed-off-by: Fengguang Wu --- binder.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -3701,26 +3701,19 @@ BINDER_DEBUG_ENTRY(transaction_log); static void binder_destroy_cache(void) { - if (binder_proc_cachep) - kmem_cache_destroy(binder_proc_cachep); + kmem_cache_destroy(binder_proc_cachep); - if (binder_thread_cachep) - kmem_cache_destroy(binder_thread_cachep); + kmem_cache_destroy(binder_thread_cachep); - if (binder_node_cachep) - kmem_cache_destroy(binder_node_cachep); + kmem_cache_destroy(binder_node_cachep); - if (binder_ref_cachep) - kmem_cache_destroy(binder_ref_cachep); + kmem_cache_destroy(binder_ref_cachep); - if (binder_transaction_cachep) - kmem_cache_destroy(binder_transaction_cachep); + kmem_cache_destroy(binder_transaction_cachep); - if (binder_work_cachep) - kmem_cache_destroy(binder_work_cachep); + kmem_cache_destroy(binder_work_cachep); - if (binder_ref_death_cachep) - kmem_cache_destroy(binder_ref_death_cachep); + kmem_cache_destroy(binder_ref_death_cachep); } static int __init binder_create_cache(void)