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