[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <300c4dd2-29bc-0f9f-1d6d-b8b65bf6c69c@amd.com>
Date: Fri, 10 Mar 2023 10:42:51 -0700
From: Rodrigo Siqueira Jordao <Rodrigo.Siqueira@....com>
To: Hamza Mahfooz <hamza.mahfooz@....com>,
amd-gfx@...ts.freedesktop.org
Cc: Harry Wentland <harry.wentland@....com>,
Leo Li <sunpeng.li@....com>,
Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, Lyude Paul <lyude@...hat.com>,
Wayne Lin <Wayne.Lin@....com>,
Qingqing Zhuo <qingqing.zhuo@....com>,
Ian Chen <ian.chen@....com>,
Sung Joon Kim <sungjoon.kim@....com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/amd/display: use a more accurate check in
dm_helpers_dp_read_dpcd()
On 3/9/23 14:30, Hamza Mahfooz wrote:
> We should be checking if drm_dp_dpcd_read() returns the size that we are
> asking it to read instead of just checking if it is greater than zero.
> Also, we should WARN_ON() here since this condition is only ever met, if
> there is an issue worth investigating. So, compare the return value of
> drm_dp_dpcd_read() to size and WARN_ON() if they aren't equal.
>
> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@....com>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> index 8d598b322e5b..ed2ed7b1d869 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> @@ -511,8 +511,8 @@ bool dm_helpers_dp_read_dpcd(
> return false;
> }
>
> - return drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address,
> - data, size) > 0;
> + return !WARN_ON(drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address,
> + data, size) != size);
> }
>
> bool dm_helpers_dp_write_dpcd(
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@....com>
and pushed to amd-staging-drm-next.
Thanks
Siqueira
Powered by blists - more mailing lists