[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 <[email protected]>
Evan > -----Original Message----- > From: Dan Carpenter <[email protected]> > Sent: Wednesday, September 6, 2023 6:55 PM > To: Quan, Evan <[email protected]>; Wang, Yang(Kevin) > <[email protected]> > Cc: Deucher, Alexander <[email protected]>; Koenig, Christian > <[email protected]>; Pan, Xinhui <[email protected]>; David > Airlie <[email protected]>; Daniel Vetter <[email protected]>; Lazar, Lijo > <[email protected]>; Kamal, Asad <[email protected]>; Zhang, > Hawking <[email protected]>; Limonciello, Mario > <[email protected]>; [email protected]; kernel- > [email protected] > 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 <[email protected]> > --- > 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
