From patchwork Sun Jul 9 09:05:10 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: 9831723 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 A363C60317 for ; Sun, 9 Jul 2017 09:05:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94BE826256 for ; Sun, 9 Jul 2017 09:05:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84B3728249; Sun, 9 Jul 2017 09:05:29 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0496E26256 for ; Sun, 9 Jul 2017 09:05:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 407E86E115; Sun, 9 Jul 2017 09:05:27 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 42B4B6E115 for ; Sun, 9 Jul 2017 09:05:26 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2017 02:05:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,333,1496127600"; d="scan'208";a="109185024" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by orsmga002.jf.intel.com with ESMTP; 09 Jul 2017 02:05:24 -0700 Received: from kbuild by bee with local (Exim 4.84_2) (envelope-from ) id 1dU8D2-000Ts7-6R; Sun, 09 Jul 2017 17:08:56 +0800 Date: Sun, 9 Jul 2017 17:05:10 +0800 From: kbuild test robot To: Lionel Landwerlin Message-ID: <20170709090510.GA145826@lkp-ib03.lkp.intel.com> References: <201707091613.63oa3bQg%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170707170838.9492-2-lionel.g.landwerlin@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 Cc: intel-gfx@lists.freedesktop.org, Andrzej Datczuk , kbuild-all@01.org, Matthew Auld Subject: [Intel-gfx] [PATCH] drm/i915: fix ifnullfree.cocci warnings X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP drivers/gpu/drm/i915/i915_perf.c:3313: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/gpu/drm/i915/i915_perf.c:3315: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/gpu/drm/i915/i915_perf.c:3317: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 Fixes: 7f475c52e3f8 ("drm/i915: Implement I915_PERF_ADD/REMOVE_CONFIG interface") CC: Matthew Auld Signed-off-by: Fengguang Wu --- i915_perf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -3309,12 +3309,9 @@ int i915_perf_remove_config_ioctl(struct sysfs_remove_group(dev_priv->perf.metrics_kobj, &oa_config->sysfs_metric); - if (oa_config->flex_regs) - kfree(oa_config->flex_regs); - if (oa_config->b_counter_regs) - kfree(oa_config->b_counter_regs); - if (oa_config->mux_regs) - kfree(oa_config->mux_regs); + kfree(oa_config->flex_regs); + kfree(oa_config->b_counter_regs); + kfree(oa_config->mux_regs); kfree(oa_config); config_err: