Re: [PATCH v15 03/23] tracing: Add hist trigger support for multiple values ('vals=' param)

From: Steven Rostedt
Date: Wed Mar 02 2016 - 09:39:11 EST


On Fri, 26 Feb 2016 10:01:06 -0600
Tom Zanussi <tom.zanussi@xxxxxxxxxxxxxxx> 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