Skip to content

Commit 0b5dfe1

Browse files
Alex Hungalexdeucher
authored andcommitted
drm/amd/display: fix a divided-by-zero error
[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]
1 parent 1e994cc commit 0b5dfe1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/gpu/drm/amd/display/modules/power/power_helpers.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,10 @@ bool psr_su_set_dsc_slice_height(struct dc *dc, struct dc_link *link,
934934

935935
pic_height = stream->timing.v_addressable +
936936
stream->timing.v_border_top + stream->timing.v_border_bottom;
937+
938+
if (stream->timing.dsc_cfg.num_slices_v == 0)
939+
return false;
940+
937941
slice_height = pic_height / stream->timing.dsc_cfg.num_slices_v;
938942
config->dsc_slice_height = slice_height;
939943

0 commit comments

Comments
 (0)