From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pawel Wodkowski Subject: Re: [PATCH v6] af_packet: Fix some klocwork errors Date: Tue, 10 Mar 2015 09:59:40 +0100 Message-ID: <54FEB27C.3040502@intel.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To: "Ouyang, Changchun" , "dev-VfR2kkLFssw@public.gmane.org" Return-path: In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 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-VfR2kkLFssw@public.gmane.org >> Cc: linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org; nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org >> 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