ACK: [SRU][N/O][PATCH] drm/amd/display: Add check for granularity in dml ceil/floor helpers

Stefan Bader stefan.bader at canonical.com
Wed Feb 12 10:39:59 UTC 2025


On 12.02.25 10:48, Timo Aaltonen wrote:
> From: Roman Li <Roman.Li at amd.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2098080
> 
> [Why]
> Wrapper functions for dcn_bw_ceil2() and dcn_bw_floor2()
> should check for granularity is non zero to avoid assert and
> divide-by-zero error in dcn_bw_ functions.
> 
> [How]
> Add check for granularity 0.
> 
> Cc: Mario Limonciello <mario.limonciello at amd.com>
> Reviewed-by: Alvin Lee <alvin.lee2 at amd.com>
> Signed-off-by: Roman Li <Roman.Li at amd.com>
> Tested-by: Daniel Wheeler <daniel.wheeler at amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> (cherry picked from commit f6e09701c3eb2ccb8cb0518e0b67f1c69742a4ec)
> Signed-off-by: Timo Aaltonen <timo.aaltonen at canonical.com>
Acked-by: Stefan Bader <stefan.bader at canonical.com>
> ---

Looks simple and clear enough.

-Stefan

>   drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
> index 072bd05396059..6b2ab4ec2b5ff 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
> @@ -66,11 +66,15 @@ static inline double dml_max5(double a, double b, double c, double d, double e)
>   
>   static inline double dml_ceil(double a, double granularity)
>   {
> +	if (granularity == 0)
> +		return 0;
>   	return (double) dcn_bw_ceil2(a, granularity);
>   }
>   
>   static inline double dml_floor(double a, double granularity)
>   {
> +	if (granularity == 0)
> +		return 0;
>   	return (double) dcn_bw_floor2(a, granularity);
>   }
>   
> @@ -114,11 +118,15 @@ static inline double dml_ceil_2(double f)
>   
>   static inline double dml_ceil_ex(double x, double granularity)
>   {
> +	if (granularity == 0)
> +		return 0;
>   	return (double) dcn_bw_ceil2(x, granularity);
>   }
>   
>   static inline double dml_floor_ex(double x, double granularity)
>   {
> +	if (granularity == 0)
> +		return 0;
>   	return (double) dcn_bw_floor2(x, granularity);
>   }
>   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xE8675DEECBEECEA3.asc
Type: application/pgp-keys
Size: 47863 bytes
Desc: OpenPGP public key
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20250212/9c4e4f67/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20250212/9c4e4f67/attachment-0001.sig>


More information about the kernel-team mailing list