Fix: Return -EINVAL instead of print warning if non power of 2 size/num_subbuf
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 22 Feb 2012 00:20:13 +0000 (19:20 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 22 Feb 2012 00:20:13 +0000 (19:20 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/ringbuffer/ring_buffer_backend.c

index 11dd924ed4e6a90fe208c0eafb0c7ae0523431e4..bfe63d7b34b913c8307ba4ae7cb17221a18287f1 100644 (file)
@@ -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)
This page took 0.026879 seconds and 4 git commands to generate.