From: Mathieu Desnoyers Date: Sat, 23 Jul 2011 16:37:54 +0000 (-0400) Subject: context: document and check that only last context is removed X-Git-Tag: v2.0-pre2~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4cae220c1be2cc73008603a21152fce7643cfc35;p=lttng-modules.git context: document and check that only last context is removed Signed-off-by: Mathieu Desnoyers --- diff --git a/ltt-context.c b/ltt-context.c index e9a45f3c..154e9966 100644 --- a/ltt-context.c +++ b/ltt-context.c @@ -60,6 +60,9 @@ struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p) } EXPORT_SYMBOL_GPL(lttng_append_context); +/* + * Remove last context field. + */ void lttng_remove_context_field(struct lttng_ctx **ctx_p, struct lttng_ctx_field *field) { @@ -67,6 +70,7 @@ void lttng_remove_context_field(struct lttng_ctx **ctx_p, ctx = *ctx_p; ctx->nr_fields--; + WARN_ON_ONCE(&ctx->fields[ctx->nr_fields] != field); memset(&ctx->fields[ctx->nr_fields], 0, sizeof(struct lttng_ctx_field)); } EXPORT_SYMBOL_GPL(lttng_remove_context_field);