[PATCH] drm/amd/display: Fix division by zero in setup_dsc_config

Markus Elfring Markus.Elfring at web.de
Mon Apr 22 15:38:43 UTC 2024


…
> +++ b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
> @@ -1055,7 +1055,12 @@ static bool setup_dsc_config(
>  	if (!is_dsc_possible)
>  		goto done;
>
> -	dsc_cfg->num_slices_v = pic_height/slice_height;
> +	if (slice_height > 0)
> +		dsc_cfg->num_slices_v = pic_height/slice_height;
> +	else {
> +		is_dsc_possible = false;
> +		goto done;
> +	}
>
>  	if (target_bandwidth_kbps > 0) {
>  		is_dsc_possible = decide_dsc_target_bpp_x16(

I suggest to take another coding style concern into account.
Please use curly brackets for both if branches.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.9-rc5#n213

Regards,
Markus


More information about the amd-gfx mailing list