From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751434AbdKVG5Q (ORCPT ); Wed, 22 Nov 2017 01:57:16 -0500 Received: from [134.134.136.100] ([134.134.136.100]:2012 "EHLO mga07.intel.com" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751216AbdKVG5P (ORCPT ); Wed, 22 Nov 2017 01:57:15 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,436,1505804400"; d="scan'208";a="4644594" Subject: Re: [PATCH v1 3/9] perf util: Reconstruct rblist for supporting per-thread shadow stats To: Ravi Bangoria Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com References: <1511189024-19908-1-git-send-email-yao.jin@linux.intel.com> <1511189024-19908-4-git-send-email-yao.jin@linux.intel.com> From: "Jin, Yao" Message-ID: Date: Wed, 22 Nov 2017 14:57:12 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/22/2017 2:31 PM, Ravi Bangoria wrote: > > On 11/20/2017 08:13 PM, Jin Yao wrote: >> @@ -76,6 +97,17 @@ static struct rb_node *saved_value_new(struct >> rblist *rblist __maybe_unused, >>       return &nd->rb_node; >>   } >> >> +static void saved_value_delete(struct rblist *rblist __maybe_unused, >> +                   struct rb_node *rb_node) >> +{ >> +    struct saved_value *v = container_of(rb_node, >> +                         struct saved_value, >> +                         rb_node); >> + >> +    if (v) >> +        free(v); >> +} > > Do we really need if(v) ? > > Thanks, > Ravi > Hi Ravi, Looks it doesn't need if(v). I put if(v) here is from my coding habits (checking pointer before free). It's OK for me if you think the code should be removed. Thanks Jin Yao