drm/amdgpu: avoid uninitialized pointer use
Subsystems (2)
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.
--- 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
@@ -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
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")Signed-off-by Arnd Bergmann <[email protected]>
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@@ -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