On Sat, Nov 28, 2026 at 11:26 AM Nathan Chancellor <[email protected]> wrote:
>
> Clang warns (or errors with CONFIG_WERROR=y / W=e):
>
> 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);
> | ^~~~
>
> It is not wrong that data is passed to program_imu_rlc_ram()
> uninitialized but since this warning happens early in clang's frontend,
> it cannot see program_imu_rlc_ram() is meber called due to r being
> -EINVAL and even if it were, data would not be dereferenced because size
> is 0, so it is never actually used uninitialized.
>
> It is bad form to pass uninitialized values to functions even if they
> are not used, so just initialize data to NULL to silence the warning, as
> it will need to be properly set up when support for calling
> program_imu_rlc_ram() is added.
>
> Fixes: 9caddf5f7de7 ("drm/amdgpu: Add imu v13 ip block v2")
> Signed-off-by: Nathan Chancellor <[email protected]>
I already squashed the identical change into the original patch last week.
Thanks,
Alex
> ---
> drivers/gpu/drm/amd/amdgpu/imu_v13_0.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c
> b/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c
> index aea418be444a..eb18c7d3e120 100644
> --- a/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c
> @@ -253,7 +253,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;
> + const u32 *data = NULL;
> int r = -EINVAL;
>
> WREG32_SOC15(GC, 0, regGFX_IMU_RLC_RAM_INDEX, 0x2);
>
> ---
> base-commit: fc652f23f1c3c727e561ca66bafd58000208e3a9
> base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> master
> change-id: 20261128-amdgpu-uninitialized-data-imu_v13_0-956b94f659dd
>
> Best regards,
> --
> Cheers,
> Nathan
>