Skip to contentSkip to conversation

drm/amdgpu: avoid uninitialized pointer use

PATCH In review Arnd Bergmann 2 participants 2 messages Dec 1

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: avoid uninitialized pointer use

From: Arnd Bergmann <[email protected]>

clang warns about passing an uninitialized pointer into another function, even when that function does not access the pointer:

drivers/gpu/drm/amd/amdgpu/imu_v13_0.c:264:30: error: variable 'data' is uninitialized when used here [-Werror,-Wuninitialized]
264 | program_imu_rlc_ram(adev, data, (const u32)size);
| ^~~~

Presumably there are plans to add an actual register array later that would make this similar to other versions of the imu code. In the meantime, remove the unused/uninitialized pointer and just pass a hardcoded NULL/0 argument to program_imu_rlc_ram.

Fixes 9caddf5f7de7 ("drm/amdgpu: Add imu v13 ip block v2")
---
 drivers/gpu/drm/amd/amdgpu/imu_v13_0.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/imu_v13_0.c +2 -3
index aea418be444a..660bd587c7d7 100644
@@ -252,8 +252,7 @@ static void program_imu_rlc_ram(struct amdgpu_device *adev,
 
 static void imu_v13_0_program_rlc_ram(struct amdgpu_device *adev)
 {
-	u32 reg_data, size = 0;
-	const u32 *data;
+	u32 reg_data;
 	int r = -EINVAL;
 
 	WREG32_SOC15(GC, 0, regGFX_IMU_RLC_RAM_INDEX, 0x2);
@@ -261,7 +260,7 @@ static void imu_v13_0_program_rlc_ram(struct amdgpu_device *adev)
 	switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
 	case IP_VERSION(13, 0, 1):
 		if (!r)
-			program_imu_rlc_ram(adev, data, (const u32)size);
+			program_imu_rlc_ram(adev, NULL, 0);
 		break;
 	default:
 		BUG();
Signature · 1 line
2.53.0
#1 lore raw
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

clang warns about passing an uninitialized pointer into another function, even when that function does not access the pointer:

drivers/gpu/drm/amd/amdgpu/imu_v13_0.c:264:30: error: variable 'data' is uninitialized when used here [-Werror,-Wuninitialized]
264 | program_imu_rlc_ram(adev, data, (const u32)size);
| ^~~~

Quoted 7 lines

Presumably there are plans to add an actual register array later that would make this similar to other versions of the imu code. In the meantime, remove the unused/uninitialized pointer and just pass a hardcoded NULL/0 argument to program_imu_rlc_ram.

Fixes 9caddf5f7de7 ("drm/amdgpu: Add imu v13 ip block v2")

Already fixed and squashed into the original patch.

Thanks,

Alex

Quoted 30 lines
---
 drivers/gpu/drm/amd/amdgpu/imu_v13_0.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/imu_v13_0.c +2 -4
index aea418be444a..660bd587c7d7 100644
@@ -252,8 +252,7 @@ static void program_imu_rlc_ram(struct amdgpu_device *adev,
 
 static void imu_v13_0_program_rlc_ram(struct amdgpu_device *adev)
 {
-       u32 reg_data, size = 0;
-       const u32 *data;
+       u32 reg_data;
        int r = -EINVAL;
 
        WREG32_SOC15(GC, 0, regGFX_IMU_RLC_RAM_INDEX, 0x2);
@@ -261,7 +260,7 @@ static void imu_v13_0_program_rlc_ram(struct amdgpu_device *adev)
        switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
        case IP_VERSION(13, 0, 1):
                if (!r)
-                       program_imu_rlc_ram(adev, data, (const u32)size);
+                       program_imu_rlc_ram(adev, NULL, 0);
                break;
        default:
                BUG();
--

2.53.0