From patchwork Wed Sep 9 22:57:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kbuild test robot X-Patchwork-Id: 516060 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1F25C140271 for ; Thu, 10 Sep 2015 08:58:55 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753984AbbIIW6l (ORCPT ); Wed, 9 Sep 2015 18:58:41 -0400 Received: from mga03.intel.com ([134.134.136.65]:65232 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753560AbbIIW6j (ORCPT ); Wed, 9 Sep 2015 18:58:39 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 09 Sep 2015 15:58:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,499,1437462000"; d="scan'208";a="558630972" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by FMSMGA003.fm.intel.com with ESMTP; 09 Sep 2015 15:58:37 -0700 Received: from kbuild by bee with local (Exim 4.83) (envelope-from ) id 1ZZoJy-000LIx-8N; Thu, 10 Sep 2015 06:58:30 +0800 Date: Thu, 10 Sep 2015 06:57:12 +0800 From: kbuild test robot To: Roopa Prabhu Cc: kbuild-all@01.org, Nikolay Aleksandrov , netdev@vger.kernel.org, Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , linux-kernel@vger.kernel.org Subject: [PATCH] ipv6: fix ifnullfree.cocci warnings Message-ID: <20150909225712.GA6796@lkp-nex05> References: <201509100609.fhjHrskx%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201509100609.fhjHrskx%fengguang.wu@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 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org net/ipv6/route.c:2946: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. 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: Roopa Prabhu Signed-off-by: Fengguang Wu --- route.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -2942,8 +2942,7 @@ cleanup: list_for_each_entry_safe(nh, nh_safe, &rt6_nh_list, next) { if (nh->rt6_info) dst_free(&nh->rt6_info->dst); - if (nh->mxc.mx) - kfree(nh->mxc.mx); + kfree(nh->mxc.mx); list_del(&nh->next); kfree(nh); }