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:51 +0000 (19:20 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 22 Feb 2012 00:20:51 +0000 (19:20 -0500)
Reported-by: Tan Dung Le Tran <tan.dung.le.tran@ericsson.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
libringbuffer/ring_buffer_backend.c

index 9b33408125e96c80981fa3f9bacdd54f716e0efb..769e24bffa0c35475aee4ddcec62b60b4b618d93 100644 (file)
@@ -220,8 +220,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.025605 seconds and 4 git commands to generate.