[PATCH] RAS: Fix the trace_show() function to output trace_count

From: Tony Luck
Date: Wed Oct 05 2022 - 12:17:26 EST


The /sys/kernel/debug/ras/daemon_active is used to indicate to some
kernel code whether there is a user mode consumer of RAS trace events
to decide whether to print to the console.

The intent was that reading daemon_active would give the same indication
to users. But the code is broken and does not display anything.

Add a seq_printf() to output the current value of the trace_count.

Fixes: d963cd95bea9 ("RAS, debugfs: Add debugfs interface for RAS subsystem")
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---
drivers/ras/debugfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ras/debugfs.c b/drivers/ras/debugfs.c
index 0d4f985afbf3..d67af5e08caf 100644
--- a/drivers/ras/debugfs.c
+++ b/drivers/ras/debugfs.c
@@ -15,7 +15,8 @@ EXPORT_SYMBOL_GPL(ras_userspace_consumers);

static int trace_show(struct seq_file *m, void *v)
{
- return atomic_read(&trace_count);
+ seq_printf(m, "%d\n", atomic_read(&trace_count));
+ return 0;
}

static int trace_open(struct inode *inode, struct file *file)
--
2.37.3