drm/amd/display: Add error check for avi and vendor infoframe setup function
authorWentao Liang <vulab@iscas.ac.cn>
Mon, 14 Apr 2025 03:14:39 +0000 (11:14 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 21 Apr 2025 14:56:13 +0000 (10:56 -0400)
The function fill_stream_properties_from_drm_display_mode() calls the
function drm_hdmi_avi_infoframe_from_display_mode() and the
function drm_hdmi_vendor_infoframe_from_display_mode(), but does
not check its return value. Log the error messages to prevent silent
failure if either function fails.

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 58e758732338ab06aec1f3a4c1066e3e0d4b1b58..d3a2567fc5b8699cede2eaf9a1155b426528aa4a 100644 (file)
@@ -6437,6 +6437,7 @@ static void fill_stream_properties_from_drm_display_mode(
        struct amdgpu_dm_connector *aconnector = NULL;
        struct hdmi_vendor_infoframe hv_frame;
        struct hdmi_avi_infoframe avi_frame;
+       ssize_t err;
 
        if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)
                aconnector = to_amdgpu_dm_connector(connector);
@@ -6483,9 +6484,17 @@ static void fill_stream_properties_from_drm_display_mode(
        }
 
        if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) {
-               drm_hdmi_avi_infoframe_from_display_mode(&avi_frame, (struct drm_connector *)connector, mode_in);
+               err = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
+                                                              (struct drm_connector *)connector,
+                                                              mode_in);
+               if (err < 0)
+                       drm_err(connector->dev, "Failed to setup avi infoframe: %zd\n", err);
                timing_out->vic = avi_frame.video_code;
-               drm_hdmi_vendor_infoframe_from_display_mode(&hv_frame, (struct drm_connector *)connector, mode_in);
+               err = drm_hdmi_vendor_infoframe_from_display_mode(&hv_frame,
+                                                                 (struct drm_connector *)connector,
+                                                                 mode_in);
+               if (err < 0)
+                       drm_err(connector->dev, "Failed to setup vendor infoframe: %zd\n", err);
                timing_out->hdmi_vic = hv_frame.vic;
        }