On Fri, 26 Feb 2016 10:01:06 -0600
Tom Zanussi <[email protected]> wrote:

> +static int create_val_field(struct hist_trigger_data *hist_data,
> +                         unsigned int val_idx,
> +                         struct trace_event_file *file,
> +                         char *field_str)
> +{
> +     struct ftrace_event_field *field = NULL;
> +     unsigned long flags = 0;
> +     int ret = 0;
> +
> +     if (WARN_ON(val_idx >= TRACING_MAP_VALS_MAX))
> +             return -EINVAL;
> +     field = trace_find_event_field(file->event_call, field_str);
> +     if (!field) {
> +             ret = -EINVAL;
> +             goto out;
> +     }
> +
> +     hist_data->fields[val_idx] = create_hist_field(field, flags);
> +     if (!hist_data->fields[val_idx]) {
> +             ret = -ENOMEM;
> +             goto out;
> +     }
> +
> +     if (WARN_ON(++hist_data->n_vals > TRACING_MAP_VALS_MAX))
> +             ret = -EINVAL;

Again, move the increment out of the WARN_ON().

> + out:
> +     return ret;
> +}
> +

-- Steve

Reply via email to