[PATCH] drm/amdgpu: fix retry loop test

Alex Deucher alexdeucher at gmail.com
Thu Sep 7 20:34:24 UTC 2023


Applied.  Thanks!

Alex

On Wed, Sep 6, 2023 at 10:00 PM Quan, Evan <Evan.Quan at amd.com> wrote:
>
> [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.quan at amd.com>
>
> Evan
> > -----Original Message-----
> > From: Dan Carpenter <dan.carpenter at linaro.org>
> > Sent: Wednesday, September 6, 2023 6:55 PM
> > To: Quan, Evan <Evan.Quan at amd.com>; Wang, Yang(Kevin)
> > <KevinYang.Wang at amd.com>
> > Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian
> > <Christian.Koenig at amd.com>; Pan, Xinhui <Xinhui.Pan at amd.com>; David
> > Airlie <airlied at gmail.com>; Daniel Vetter <daniel at ffwll.ch>; Lazar, Lijo
> > <Lijo.Lazar at amd.com>; Kamal, Asad <Asad.Kamal at amd.com>; Zhang,
> > Hawking <Hawking.Zhang at amd.com>; Limonciello, Mario
> > <Mario.Limonciello at amd.com>; amd-gfx at lists.freedesktop.org; kernel-
> > janitors at 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.carpenter at 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
>


More information about the amd-gfx mailing list