]> Git Repo - linux.git/commitdiff
drm/amd/display: fix a divided-by-zero error
authorAlex Hung <[email protected]>
Mon, 3 Apr 2023 09:45:41 +0000 (17:45 +0800)
committerAlex Deucher <[email protected]>
Tue, 18 Apr 2023 21:20:00 +0000 (17:20 -0400)
[Why & How]

timing.dsc_cfg.num_slices_v can be zero and it is necessary to check
before using it.

This fixes the error "divide error: 0000 [#1] PREEMPT SMP NOPTI".

Reviewed-by: Aurabindo Pillai <[email protected]>
Acked-by: Qingqing Zhuo <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected]
drivers/gpu/drm/amd/display/modules/power/power_helpers.c

index e39b133d05af4e47f17c8993080160726c8ab3f6..b56f07f99d092bc83819ad7014cbb5492f415483 100644 (file)
@@ -934,6 +934,10 @@ bool psr_su_set_dsc_slice_height(struct dc *dc, struct dc_link *link,
 
        pic_height = stream->timing.v_addressable +
                stream->timing.v_border_top + stream->timing.v_border_bottom;
+
+       if (stream->timing.dsc_cfg.num_slices_v == 0)
+               return false;
+
        slice_height = pic_height / stream->timing.dsc_cfg.num_slices_v;
        config->dsc_slice_height = slice_height;
 
This page took 0.059948 seconds and 4 git commands to generate.