Re: [PATCH 3/4] trace-cmd: Handle opcode parsing error

From: Vaibhav Nagarnaik
Date: Mon Jul 25 2011 - 14:07:39 EST


On Mon, Jul 25, 2011 at 7:01 AM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> On Fri, 2011-07-15 at 20:00 -0700, Vaibhav Nagarnaik wrote:
>>
>>  /* Note, *tok does not get freed, but will most likely be saved */
>> @@ -1706,7 +1706,10 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
>>               arg->op.op = token;
>>               arg->op.left = left;
>>
>> -             set_op_prio(arg);
>> +             if (-1 == set_op_prio(arg)) {
>
> I'm fine with the patch up to here. I understand the constant first
> compare, but it doesn't make sense here. Either use:
>
>        if (set_op_prio(arg) < 0) ...
>  or
>        if (set_op_prio(arg) == -1)...
>
>
> The reason the -1 == doesn't make sense is because:
>
>        if (set_op_proi(arg) = -1)
>
> would fail too.
>
> And it is much easier to read.
>
> -- Steve
>

Sure. I am sending the updated patch.

>> +                     event->flags |= EVENT_FL_FAILED;
>> +                     goto out_free;
>> +             }
>>
>>               type = read_token_item(&token);
>>               *tok = token;
>
>
>

Vaibhav Nagarnaik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/