From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 68E665A68 for ; Tue, 10 Mar 2015 10:00:47 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 10 Mar 2015 01:59:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,373,1422950400"; d="scan'208";a="696406386" Received: from unknown (HELO [10.217.248.62]) ([10.217.248.62]) by orsmga002.jf.intel.com with ESMTP; 10 Mar 2015 02:00:45 -0700 Message-ID: <54FEB27C.3040502@intel.com> Date: Tue, 10 Mar 2015 09:59:40 +0100 From: Pawel Wodkowski User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "Ouyang, Changchun" , "dev@dpdk.org" References: <1425891491-28779-1-git-send-email-changchun.ouyang@intel.com> <1425958188-25041-1-git-send-email-changchun.ouyang@intel.com> <54FEAD20.8030901@intel.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6] af_packet: Fix some klocwork errors X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2015 09:00:47 -0000 On 2015-03-10 09:49, Ouyang, Changchun wrote: > > >> -----Original Message----- >> From: Wodkowski, PawelX >> Sent: Tuesday, March 10, 2015 4:37 PM >> To: Ouyang, Changchun; dev@dpdk.org >> Cc: linville@tuxdriver.com; nhorman@tuxdriver.com >> Subject: Re: [PATCH v6] af_packet: Fix some klocwork errors >> >>> - >>> - return 0; >>> +exit: >>> + if (kvlist != NULL) >> >> No need for if(). This part was fine previous patch. >> > > If kvlist is NULL, no reason to call rte_kvargs_free to free it. > So, adding this test is better. For programmer convenience and reduce code bloat/obfuscation the same test is in rte_kvargs_free() (and every other free-like function). If there is no particular reason for that (ex performance which is not in this path) checking pointer for NULL value should be avoided before freeing it. > >>> + rte_kvargs_free(kvlist); >>> + return ret; >>> } >>> >>> static struct rte_driver pmd_af_packet_drv = { >>> >> >> >> -- >> Pawel -- Pawel