[AMD Official Use Only - General]

Yeah, nice catch. But personally I would prefer to change the check as "if 
(retry <= 0)".
Either way, the patch is reviewed-by: Evan Quan <evan.q...@amd.com>

Evan
> -----Original Message-----
> From: Dan Carpenter <dan.carpen...@linaro.org>
> Sent: Wednesday, September 6, 2023 6:55 PM
> To: Quan, Evan <evan.q...@amd.com>; Wang, Yang(Kevin)
> <kevinyang.w...@amd.com>
> Cc: Deucher, Alexander <alexander.deuc...@amd.com>; Koenig, Christian
> <christian.koe...@amd.com>; Pan, Xinhui <xinhui....@amd.com>; David
> Airlie <airl...@gmail.com>; Daniel Vetter <dan...@ffwll.ch>; Lazar, Lijo
> <lijo.la...@amd.com>; Kamal, Asad <asad.ka...@amd.com>; Zhang,
> Hawking <hawking.zh...@amd.com>; Limonciello, Mario
> <mario.limoncie...@amd.com>; amd-gfx@lists.freedesktop.org; kernel-
> janit...@vger.kernel.org
> Subject: [PATCH] drm/amdgpu: fix retry loop test
>
> This loop will exit with "retry" set to -1 if it fails but the code
> checks for if "retry" is zero.  Fix this by changing post-op to a
> pre-op.  --retry vs retry--.
>
> Fixes: e01eeffc3f86 ("drm/amd/pm: avoid driver getting empty metrics table
> for the first time")
> Signed-off-by: Dan Carpenter <dan.carpen...@linaro.org>
> ---
> Obviously this only loop 99 times now instead of a hundred but that's
> fine, this is an approximation.
>
>  drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> index ff58ee14a68f..20163a9b2a66 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> @@ -336,7 +336,7 @@ static int smu_v13_0_6_setup_driver_pptable(struct
> smu_context *smu)
>
>       /* Store one-time values in driver PPTable */
>       if (!pptable->Init) {
> -             while (retry--) {
> +             while (--retry) {
>                       ret = smu_v13_0_6_get_metrics_table(smu, NULL,
> true);
>                       if (ret)
>                               return ret;
> --
> 2.39.2

Reply via email to