[PATCH] drm/amd/display: Fix && vs || in 'edp_set_replay_allow_active()'

Li, Roman Roman.Li at amd.com
Mon Feb 12 15:27:36 UTC 2024


[AMD Official Use Only - General]

Reviewed-by: Roman Li <roman.li at amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of
> Srinivasan Shanmugam
> Sent: Friday, February 9, 2024 9:53 AM
> To: Siqueira, Rodrigo <Rodrigo.Siqueira at amd.com>; Pillai, Aurabindo
> <Aurabindo.Pillai at amd.com>
> Cc: amd-gfx at lists.freedesktop.org; SHANMUGAM, SRINIVASAN
> <SRINIVASAN.SHANMUGAM at amd.com>; Lakha, Bhawanpreet
> <Bhawanpreet.Lakha at amd.com>; Wentland, Harry
> <Harry.Wentland at amd.com>
> Subject: [PATCH] drm/amd/display: Fix && vs || in
> 'edp_set_replay_allow_active()'
>
> AND should be OR or it will lead to a NULL dereference.
>
> Fixes the below:
> drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_
> control.c:895 edp_set_replay_allow_active() error: we previously assumed
> 'replay' could be null (see line 887)
>
> Fixes: c7ddc0a800bc ("drm/amd/display: Add Functions to enable Freesync
> Panel Replay")
> Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha at amd.com>
> Cc: Harry Wentland <harry.wentland at amd.com>
> Cc: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
> Cc: Aurabindo Pillai <aurabindo.pillai at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
> ---
>  .../drm/amd/display/dc/link/protocols/link_edp_panel_control.c  | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git
> a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
> b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
> index 443215b96308..77648228ec60 100644
> ---
> a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
> +++
> b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
> @@ -884,7 +884,7 @@ bool edp_set_replay_allow_active(struct dc_link
> *link, const bool *allow_active,
>       struct dmub_replay *replay = dc->res_pool->replay;
>       unsigned int panel_inst;
>
> -     if (replay == NULL && force_static)
> +     if (!replay || force_static)
>               return false;
>
>       if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
> --
> 2.34.1



More information about the amd-gfx mailing list