[1/2] drm/amd/pm: Fix warn: missing error code in smu_v13_0_0_check_ecc_table_support()

Message ID 20230926055700.119576-1-liucong2@kylinos.cn
State New
Headers
Series [1/2] drm/amd/pm: Fix warn: missing error code in smu_v13_0_0_check_ecc_table_support() |

Commit Message

Cong Liu Sept. 26, 2023, 5:56 a.m. UTC
  This patch fixes a smatch warning:

drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_0_ppt.c:2868
smu_v13_0_0_check_ecc_table_support() warn: missing error code? 'ret'

This warning is caused by the fact that this function returns the value of
the variable ret. However, the value of ret is not explicitly set in the
function. This patch fixes the warning by explicitly setting the value of
ret to 0 if the device is supported

Signed-off-by: Cong Liu <liucong2@kylinos.cn>
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
index 9ac2be5627d9..cf832cef2b0a 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
@@ -2863,11 +2863,11 @@  static int smu_v13_0_0_check_ecc_table_support(struct smu_context *smu)
 	if (ret)
 		return -EOPNOTSUPP;
 
-	if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 10)) &&
-		(smu_version >= SUPPORT_ECCTABLE_SMU_13_0_10_VERSION))
-		return ret;
-	else
+	if ((adev->ip_versions[MP1_HWIP][0] != IP_VERSION(13, 0, 10)) &&
+		(smu_version < SUPPORT_ECCTABLE_SMU_13_0_10_VERSION))
 		return -EOPNOTSUPP;
+
+	return 0;
 }
 
 static ssize_t smu_v13_0_0_get_ecc_info(struct smu_context *smu,