mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4] mfd: intel-lpss: Prevent DebugFS messages if it is not initialized
@ 2026-09-14 11:21 Maria Lisina via B4 Relay
  2026-09-14 12:49 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Maria Lisina via B4 Relay @ 2026-09-14 11:21 UTC (permalink / raw)
  To: Andy Shevchenko, Lee Jones; +Cc: mfd, linux-kernel, Maria Lisina

From: Maria Lisina <sekoohaka.sarisan@gmail.com>

The original code expects DebugFS to be always initialized which
causes unwanted warnings when DebugFS is simply disabled.

Therefore it spams dmesg with these messages:

  intel-lpss 0000:00:15.0: Failed to create debugfs entries
  intel-lpss 0000:00:15.3: Failed to create debugfs entries
  intel-lpss 0000:00:1e.0: Failed to create debugfs entries
  intel-lpss 0000:00:1e.2: Failed to create debugfs entries

This patch adds proper check to intel_lpss_init() and
intel_lpss_debugfs_add() functions to prevent writing to
uninitialized DebugFS.

Signed-off-by: Maria Lisina <sekoohaka.sarisan@gmail.com>
---
Changes in v4:
- Keep the dmesg messages, instead check whether DebugFS is initialized
- Link to v3: https://lore.kernel.org/r/20260913-intel-lpss-debugfs-v3-1-1b8e2b1f0992@gmail.com

Changes in v3:
- Fixed commit name and description.
- Link to v2: https://lore.kernel.org/r/20260913-intel-lpss-debugfs-v2-1-a1a4faf5cc63@gmail.com

Changes in v2:
- Fixed function name in comment section.
- Link to v1: https://lore.kernel.org/r/20260913-intel-lpss-debugfs-v1-1-833cbb6fffc9@gmail.com
---
 drivers/mfd/intel-lpss.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index 63d6694f71457b2e09d238af0a9bfb897a169a64..d45728f46c499b3f0c3713d30a17b0ae12106095 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -146,6 +146,12 @@ static int intel_lpss_debugfs_add(struct intel_lpss *lpss)
 {
 	struct dentry *dir;
 
+	/* Exit if DebugFS is not initialized */
+	if (!intel_lpss_debugfs) {
+		lpss->debugfs = NULL;
+		return 0;
+	}
+
 	dir = debugfs_create_dir(dev_name(lpss->dev), intel_lpss_debugfs);
 	if (IS_ERR(dir))
 		return PTR_ERR(dir);
@@ -538,7 +544,15 @@ EXPORT_NS_GPL_DEV_PM_OPS(intel_lpss_pm_ops, INTEL_LPSS) = {
 
 static int __init intel_lpss_init(void)
 {
-	intel_lpss_debugfs = debugfs_create_dir("intel_lpss", NULL);
+	/*
+	 * Check whether DebugFS is initialized to
+	 * prevent unwanted dmesg messages.
+	 */
+	if (debugfs_initialized())
+		intel_lpss_debugfs = debugfs_create_dir("intel_lpss", NULL);
+	else
+		intel_lpss_debugfs = NULL;
+
 	return 0;
 }
 module_init(intel_lpss_init);

---
base-commit: 2f0c1cf72f4682178506f513bbf015e591b1aa4a
change-id: 20260913-intel-lpss-debugfs-eff3580d1295

Best regards,
-- 
Maria Lisina <sekoohaka.sarisan@gmail.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v4] mfd: intel-lpss: Prevent DebugFS messages if it is not initialized
  2026-09-14 11:21 [PATCH v4] mfd: intel-lpss: Prevent DebugFS messages if it is not initialized Maria Lisina via B4 Relay
@ 2026-09-14 12:49 ` Andy Shevchenko
  2026-09-14 14:27   ` Maria Lisina
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2026-09-14 12:49 UTC (permalink / raw)
  To: sekoohaka.sarisan; +Cc: Lee Jones, mfd, linux-kernel

On Mon, Sep 14, 2026 at 04:21:31PM +0500, Maria Lisina via B4 Relay wrote:

> The original code expects DebugFS to be always initialized which
> causes unwanted warnings when DebugFS is simply disabled.
> 
> Therefore it spams dmesg with these messages:
> 
>   intel-lpss 0000:00:15.0: Failed to create debugfs entries
>   intel-lpss 0000:00:15.3: Failed to create debugfs entries
>   intel-lpss 0000:00:1e.0: Failed to create debugfs entries
>   intel-lpss 0000:00:1e.2: Failed to create debugfs entries

In previous review I pointed out that one of such a message is enough,
no need to repeat it for each LPSS device in the system.

> This patch adds proper check to intel_lpss_init() and
> intel_lpss_debugfs_add() functions to prevent writing to
> uninitialized DebugFS.

...

> Changes in v4:
> - Keep the dmesg messages, instead check whether DebugFS is initialized
> - Link to v3: https://lore.kernel.org/r/20260913-intel-lpss-debugfs-v3-1-1b8e2b1f0992@gmail.com

I mentioned that switching to the debug (or info) level is fine,
I'm a bit puzzled what this version is trying to achieve. Strictly
speaking the debugfs is designed in the way that no checks are
required at all. In this case we want the user be informed about
this as debugfs carries the LTR values.

So, I expect to see dev_warn() --> dev_dbg() or dev_info() in one-liner.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v4] mfd: intel-lpss: Prevent DebugFS messages if it is not initialized
  2026-09-14 12:49 ` Andy Shevchenko
@ 2026-09-14 14:27   ` Maria Lisina
  0 siblings, 0 replies; 3+ messages in thread
From: Maria Lisina @ 2026-09-14 14:27 UTC (permalink / raw)
  To: andriy.shevchenko; +Cc: lee, linux-kernel, mfd, sekoohaka.sarisan

I'm sorry, I didn't notice the part about commit description.

Also I don't really get it how is this dmesg message mandatory
when DebugFS is completely disabled. It makes no sense to me.
If user needs these LTR values for debugging purposes they should
know about DebugFS. In other cases when DebugFS is disabled these
messages shouldn't even appear as these LTR values stored in DebugFS
don't do anything, at least if I remember correctly they aren't used
for any purpose other than debugging while being exposed in DebugFS.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-14 14:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 11:21 [PATCH v4] mfd: intel-lpss: Prevent DebugFS messages if it is not initialized Maria Lisina via B4 Relay
2026-09-14 12:49 ` Andy Shevchenko
2026-09-14 14:27   ` Maria Lisina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®