Chrome platform driver development
 help / color / mirror / Atom feed
* [PATCH v2 1/2] platform/chrome: cros_ec_debugfs: clean up console log on probe failure
@ 2026-07-29 10:32 Hongyan Xu
  2026-07-29 10:32 ` [PATCH v2 2/2] platform/chrome: cros_ec_debugfs: unregister panic notifier Hongyan Xu
  2026-07-30  1:48 ` [PATCH v2 1/2] platform/chrome: cros_ec_debugfs: clean up console log on probe failure Tzung-Bi Shih
  0 siblings, 2 replies; 3+ messages in thread
From: Hongyan Xu @ 2026-07-29 10:32 UTC (permalink / raw)
  To: bleung, tzungbi; +Cc: groeck, chrome-platform, linux-kernel, jianhao.xu

cros_ec_create_console_log() starts log_poll_work when console logging is
supported. If the following panic notifier registration fails, probe
removes the debugfs entries but leaves the delayed work scheduled. The
work can then access devm-managed data after the failed probe tears it
down.

Add a dedicated error label for failures after successful console log
setup. Earlier failures keep using the existing debugfs-only cleanup
path.

This issue was found by a static analysis tool.

Fixes: d90fa2c64d59 ("platform/chrome: cros_ec: Poll EC log on EC panic")
Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
---
Changes in v2:
- Split the console log probe cleanup into a separate patch.
- Add a dedicated cleanup_console_log error label.

Link to v1: https://lore.kernel.org/r/20260728123423.781-3-getshell@seu.edu.cn

 drivers/platform/chrome/cros_ec_debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c
index 92ac9a2..a781bb5 100644
--- a/drivers/platform/chrome/cros_ec_debugfs.c
+++ b/drivers/platform/chrome/cros_ec_debugfs.c
@@ -525,7 +525,7 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
 	ret = blocking_notifier_chain_register(&ec->ec_dev->panic_notifier,
 					       &debug_info->notifier_panic);
 	if (ret)
-		goto remove_debugfs;
+		goto cleanup_console_log;
 
 	ec->debug_info = debug_info;
 
@@ -533,6 +533,8 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
 
 	return 0;
 
+cleanup_console_log:
+	cros_ec_cleanup_console_log(debug_info);
 remove_debugfs:
 	debugfs_remove_recursive(debug_info->dir);
 	return ret;
-- 
2.50.1.windows.1

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

end of thread, other threads:[~2026-07-30  1:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 10:32 [PATCH v2 1/2] platform/chrome: cros_ec_debugfs: clean up console log on probe failure Hongyan Xu
2026-07-29 10:32 ` [PATCH v2 2/2] platform/chrome: cros_ec_debugfs: unregister panic notifier Hongyan Xu
2026-07-30  1:48 ` [PATCH v2 1/2] platform/chrome: cros_ec_debugfs: clean up console log on probe failure Tzung-Bi Shih

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