public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Aaron Tomlin <atomlin@atomlin.com>
To: tony.luck@intel.com, reinette.chatre@intel.com,
	Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com,
	tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com
Cc: dave.martin@arm.com, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] fs/resctrl: resctrl: Return -EINVAL for a missing seq_show implementation
Date: Thu,  6 Nov 2025 20:24:01 -0500	[thread overview]
Message-ID: <20251107012401.224515-3-atomlin@atomlin.com> (raw)
In-Reply-To: <20251107012401.224515-1-atomlin@atomlin.com>

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@atomlin.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


      parent reply	other threads:[~2025-11-07  1:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07  1:23 [PATCH 0/2] x86/resctrl: Add io_alloc_min_cbm_all interface for CBM reset Aaron Tomlin
2025-11-07  1:24 ` [PATCH 1/2] " Aaron Tomlin
2025-11-07 22:02   ` Moger, Babu
2025-11-07 22:25     ` Aaron Tomlin
2025-11-07 23:08       ` Moger, Babu
2025-11-08  0:19         ` Aaron Tomlin
2025-11-08  0:42           ` Luck, Tony
2025-11-10 16:34           ` Babu Moger
2025-11-10 17:50             ` Luck, Tony
2025-11-10 19:42               ` Babu Moger
2025-11-10 19:56                 ` Luck, Tony
2025-11-10 21:40                   ` Reinette Chatre
2025-11-11  0:41             ` Aaron Tomlin
2025-11-11  0:51               ` Luck, Tony
2025-11-11  1:00                 ` Reinette Chatre
2025-11-11  1:40                   ` Luck, Tony
2025-11-11  2:37                     ` Reinette Chatre
2025-11-11  2:44                     ` Aaron Tomlin
2025-11-11 15:29                       ` Babu Moger
2025-11-11 21:04                         ` Babu Moger
2025-11-11 22:34                           ` Aaron Tomlin
2025-11-11 23:21                             ` Moger, Babu
2025-11-07  1:24 ` Aaron Tomlin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251107012401.224515-3-atomlin@atomlin.com \
    --to=atomlin@atomlin.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=reinette.chatre@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox