drm/amdgpu: fix retry loop test
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 6 Sep 2023 10:54:38 +0000 (13:54 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 11 Sep 2023 21:13:57 +0000 (17:13 -0400)
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")
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c

index e69e82deae545db8d992b0d88311ad9d34787e98..c2308783053c1393afcad4f291b9d280cad09f5e 100644 (file)
@@ -337,7 +337,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;