]> www.infradead.org Git - nvme.git/commitdiff
drm/amd/display: Check and log for function error codes
authorAlex Hung <alex.hung@amd.com>
Tue, 11 Jun 2024 17:41:32 +0000 (11:41 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Jun 2024 21:10:36 +0000 (17:10 -0400)
[WHAT & HOW]
BIOS_CMD_TABLE_REVISION and link_transmitter_control can return error
codes and errors should be reported.

This fixes 3 CHECKED_RETURN issues reported by Coverity.

Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Hung <alex.hung@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/bios/command_table2.c
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c

index cc000833d3001957f7e7c37714feacaf0b520133..4254bdfefe38c2e2c158b3c46292ba7f564c06a1 100644 (file)
@@ -227,7 +227,8 @@ static void init_transmitter_control(struct bios_parser *bp)
        uint8_t frev;
        uint8_t crev = 0;
 
-       BIOS_CMD_TABLE_REVISION(dig1transmittercontrol, frev, crev);
+       if (!BIOS_CMD_TABLE_REVISION(dig1transmittercontrol, frev, crev))
+               BREAK_TO_DEBUGGER();
 
        switch (crev) {
        case 6:
index 136bd93c3b655400926feb28ada3b2e7036c8838..4a9d07c31bc5b1fdae569ec667c9d6f39e59a3ff 100644 (file)
@@ -1361,7 +1361,10 @@ void dce110_link_encoder_dp_set_lane_settings(
                cntl.lane_settings = training_lane_set.raw;
 
                /* call VBIOS table to set voltage swing and pre-emphasis */
-               link_transmitter_control(enc110, &cntl);
+               if (link_transmitter_control(enc110, &cntl) != BP_RESULT_OK) {
+                       DC_LOG_ERROR("%s: Failed to execute VBIOS command table!\n", __func__);
+                       BREAK_TO_DEBUGGER();
+               }
        }
 }
 
index 4d0eed7598b2eb98bcde27b45a44d355610f1704..e0558a78b11c23512ad42aab032327480916fafb 100644 (file)
@@ -1104,6 +1104,7 @@ void dcn10_link_encoder_dp_set_lane_settings(
        union dpcd_training_lane_set training_lane_set = { { 0 } };
        int32_t lane = 0;
        struct bp_transmitter_control cntl = { 0 };
+       enum bp_result result;
 
        if (!link_settings) {
                BREAK_TO_DEBUGGER();
@@ -1138,7 +1139,12 @@ void dcn10_link_encoder_dp_set_lane_settings(
                cntl.lane_settings = training_lane_set.raw;
 
                /* call VBIOS table to set voltage swing and pre-emphasis */
-               link_transmitter_control(enc10, &cntl);
+               result = link_transmitter_control(enc10, &cntl);
+
+               if (result != BP_RESULT_OK) {
+                       DC_LOG_ERROR("%s: Failed to execute VBIOS command table!\n", __func__);
+                       BREAK_TO_DEBUGGER();
+               }
        }
 }