lkml.org 
[lkml]   [2017]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1 3/9] perf util: Reconstruct rblist for supporting per-thread shadow stats
From
Date


On 11/22/2017 4:32 PM, Jiri Olsa wrote:
> On Wed, Nov 22, 2017 at 02:57:12PM +0800, Jin, Yao wrote:
>>
>>
>> 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.
>
> you could add BUG_ON(!rb_node);
>
> jirka
>

Good idea! I will add BUG_ON checking there.

Thanks
Jin Yao

\
 
 \ /
  Last update: 2017-11-22 13:04    [W:0.201 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site