Let's move the NULL buf check to the file "open", where it belongs. The
"open" file operation is the actual interface between lib ring buffer
and the modules using it.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
if (config->output != RING_BUFFER_MMAP)
return -EINVAL;
- if (!buf)
- return -EBADF;
-
mmap_buf_len = chan->backend.buf_size;
if (chan->backend.extra_reader_sb)
mmap_buf_len += chan->backend.subbuf_size;
struct lib_ring_buffer *buf = inode->i_private;
int ret;
+ if (!buf)
+ return -EINVAL;
+
ret = lib_ring_buffer_open_read(buf);
if (ret)
return ret;