From: Mathieu Desnoyers Date: Wed, 22 Feb 2012 00:20:13 +0000 (-0500) Subject: Fix: Return -EINVAL instead of print warning if non power of 2 size/num_subbuf X-Git-Tag: v2.0.0-rc2~3 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=863497faa1facd29322a990accfd911c8c55b2cc;p=lttng-modules.git Fix: Return -EINVAL instead of print warning if non power of 2 size/num_subbuf Signed-off-by: Mathieu Desnoyers --- diff --git a/lib/ringbuffer/ring_buffer_backend.c b/lib/ringbuffer/ring_buffer_backend.c index 11dd924e..bfe63d7b 100644 --- a/lib/ringbuffer/ring_buffer_backend.c +++ b/lib/ringbuffer/ring_buffer_backend.c @@ -317,8 +317,10 @@ int channel_backend_init(struct channel_backend *chanb, /* * Make sure the number of subbuffers and subbuffer size are power of 2. */ - CHAN_WARN_ON(chanb, hweight32(subbuf_size) != 1); - CHAN_WARN_ON(chanb, hweight32(num_subbuf) != 1); + if (hweight32(subbuf_size) != 1) + return -EINVAL; + if (hweight32(num_subbuf) != 1) + return -EINVAL; ret = subbuffer_id_check_index(config, num_subbuf); if (ret)