[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251107012401.224515-3-atomlin@atomlin.com>
Date: Thu, 6 Nov 2025 20:24:01 -0500
From: Aaron Tomlin <atomlin@...mlin.com>
To: tony.luck@...el.com,
reinette.chatre@...el.com,
Dave.Martin@....com,
james.morse@....com,
babu.moger@....com,
tglx@...utronix.de,
mingo@...hat.com,
bp@...en8.de,
dave.hansen@...ux.intel.com
Cc: dave.martin@....com,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] fs/resctrl: resctrl: Return -EINVAL for a missing seq_show implementation
The rdtgroup_seqfile_show() function, which is the sequence file handler
for reading data from resctrl files, previously returned 0 (success) if
the file's associated rftype did not define a .seq_show implementation.
This behavior is incorrect and confusing, as a read operation that
does not define a display function should be treated as an error.
This patch change the function to return -EINVAL if the file type
handler (i.e., rft->seq_show) is NULL, providing proper feedback that
the operation is invalid for that file.
Signed-off-by: Aaron Tomlin <atomlin@...mlin.com>
---
fs/resctrl/rdtgroup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index bd41ab5a8eb4..661a38176d19 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -314,7 +314,8 @@ static int rdtgroup_seqfile_show(struct seq_file *m, void *arg)
if (rft->seq_show)
return rft->seq_show(of, m, arg);
- return 0;
+
+ return -EINVAL;
}
static ssize_t rdtgroup_file_write(struct kernfs_open_file *of, char *buf,
--
2.51.0
Powered by blists - more mailing lists