[v8,5/5] drm/display: hdmi-state-helper: Init SCDC debugfs for HDMI

Message ID 20260722-scdc-link-health-v8-5-cd1dacbb85d9@collabora.com (mailing list archive)
State New
Headers
Series Add SCDC information to connector debugfs |

Commit Message

Nicolas Frattaroli July 22, 2026, 9:11 a.m. UTC
Initialise the SCDC debugfs file for connectors that call the HDMI state
helper's debugfs_init helper. This makes all connectors that use the
helper expose the scdc_status file in their connector debugfs.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
---
 drivers/gpu/drm/display/drm_hdmi_state_helper.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

sashiko-bot@kernel.org July 22, 2026, 9:50 a.m. UTC | #1
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing `mutex_unlock()` in `scdc_status_show()` error path leads to a permanent deadlock.
--

--- Patch [5]: [PATCH v8 5/5] drm/display: hdmi-state-helper: Init SCDC debugfs for HDMI ---
commit a1a858eb6a63d66446abae1340fa115153801dc6
Author: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>

drm/display: hdmi-state-helper: Init SCDC debugfs for HDMI

This commit initialises the SCDC debugfs file for connectors that call the
HDMI state helper's debugfs_init helper, making the scdc_status file
available in their connector debugfs.

> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> index 8d5ee10ceb874..709524b40c26f 100644
> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
[ ... ]
> @@ -1116,6 +1117,7 @@ void drm_hdmi_connector_debugfs_init(struct drm_connector *connector,
>  		return;
>  
>  	create_hdmi_infoframe_files(connector, dir);
> +	drm_scdc_debugfs_init(connector, root);

[Severity: High]
Does exposing this debugfs file introduce a deadlock if it is read while the
display is disconnected?

Looking at the file operations wired up here, if a user reads the scdc_status
file when the connector is disconnected:

drivers/gpu/drm/display/drm_scdc_helper.c:scdc_status_show() {
	...
	mutex_lock(&connector->dev->mode_config.mutex);
	...
	if (connector->status != connector_status_connected) {
		ret = -ENODEV;
		goto err_conn_put;
	}
	...
err_unlock:
	mutex_unlock(&connector->dev->mode_config.mutex);
err_conn_put:
	drm_connector_put(connector);
	...
}

It appears the error path jumps to err_conn_put, bypassing the mutex_unlock() 
at err_unlock. Could this permanently lock mode_config.mutex and cause 
subsequent DRM mode setting operations to hang?

>  }
>  EXPORT_SYMBOL(drm_hdmi_connector_debugfs_init);
  

Patch

diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index 8d5ee10ceb87..709524b40c26 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -13,6 +13,7 @@ 
 #include <drm/display/drm_hdmi_cec_helper.h>
 #include <drm/display/drm_hdmi_helper.h>
 #include <drm/display/drm_hdmi_state_helper.h>
+#include <drm/display/drm_scdc_helper.h>
 
 /**
  * DOC: hdmi helpers
@@ -1116,6 +1117,7 @@  void drm_hdmi_connector_debugfs_init(struct drm_connector *connector,
 		return;
 
 	create_hdmi_infoframe_files(connector, dir);
+	drm_scdc_debugfs_init(connector, root);
 }
 EXPORT_SYMBOL(drm_hdmi_connector_debugfs_init);