[PATCH 2/2] drm/amdgpu: fix uninitialized variable warning

Bob Zhou bob.zhou at amd.com
Tue Apr 23 05:33:34 UTC 2024


Because the val isn't initialized, a random variable is set by amdgpu_i2c_put_byte.
So fix the uninitialized issue.

Signed-off-by: Bob Zhou <bob.zhou at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
index 82608df43396..d4d2dc792b60 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
@@ -368,7 +368,7 @@ amdgpu_i2c_router_select_ddc_port(const struct amdgpu_connector *amdgpu_connecto
 void
 amdgpu_i2c_router_select_cd_port(const struct amdgpu_connector *amdgpu_connector)
 {
-	u8 val;
+	u8 val = 0;
 
 	if (!amdgpu_connector->router.cd_valid)
 		return;
-- 
2.34.1



More information about the amd-gfx mailing list