drm/amd/display: Check status from dpcd_get_tunneling_device_data
authorAlex Hung <alex.hung@amd.com>
Mon, 30 Sep 2024 17:45:12 +0000 (11:45 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Oct 2024 15:22:42 +0000 (11:22 -0400)
[WHAT & HOW]
dpcd_get_tunneling_device_data calls core_link_read_dpcd which can
fail. The status from core_link_read_dpcd should be checked and error
messages is printed in case of failures.

This fixes 1 UNUSED_VALUE issue reported by Coverity.

Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Roman Li <roman.li@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia.c

index 2868414..2ec968f 100644 (file)
@@ -1636,6 +1636,8 @@ static bool retrieve_link_cap(struct dc_link *link)
 
        /* Read DP tunneling information. */
        status = dpcd_get_tunneling_device_data(link);
+       if (status != DC_OK)
+               dm_error("%s: Read tunndeling device data failed.\n", __func__);
 
        dpcd_set_source_specific_data(link);
        /* Sink may need to configure internals based on vendor, so allow some
index 6af42ba..0d123e6 100644 (file)
@@ -59,12 +59,18 @@ enum dc_status dpcd_get_tunneling_device_data(struct dc_link *link)
                        dpcd_dp_tun_data,
                        sizeof(dpcd_dp_tun_data));
 
+       if (status != DC_OK)
+               goto err;
+
        status = core_link_read_dpcd(
                        link,
                        DP_USB4_ROUTER_TOPOLOGY_ID,
                        dpcd_topology_data,
                        sizeof(dpcd_topology_data));
 
+       if (status != DC_OK)
+               goto err;
+
        link->dpcd_caps.usb4_dp_tun_info.dp_tun_cap.raw =
                        dpcd_dp_tun_data[DP_TUNNELING_CAPABILITIES_SUPPORT - DP_TUNNELING_CAPABILITIES_SUPPORT];
        link->dpcd_caps.usb4_dp_tun_info.dpia_info.raw =
@@ -75,6 +81,7 @@ enum dc_status dpcd_get_tunneling_device_data(struct dc_link *link)
        for (i = 0; i < DPCD_USB4_TOPOLOGY_ID_LEN; i++)
                link->dpcd_caps.usb4_dp_tun_info.usb4_topology_id[i] = dpcd_topology_data[i];
 
+err:
        return status;
 }