diff --git a/kernel/relay.c b/kernel/relay.cI suggest replacing IS_ERR_OR_NULL with IS_ERR instead of removing it due to the possibility of create_buf_file callback returning an error.
index a8e90e98bf2c..0d8b8325530a 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -391,12 +391,13 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu)
goto free_buf;
relay_set_buf_dentry(buf, dentry);
} else {
- /* Only retrieve global info, nothing more, nothing less */
+ /* In buffer-only mode, relay_open_buf is called with
+ * filename=NULL, but create_buf_file is still needed to
+ * retrieve is_global info. So dentry should be NULL here.
+ */
dentry = chan->cb->create_buf_file(NULL, NULL,
S_IRUSR, buf,
&chan->is_global);
- if (IS_ERR_OR_NULL(dentry))
- goto free_buf;
}
buf->cpu = cpu;