* [PATCH] drm/amdgpu: Initialize data to NULL in imu_v13_0_program_rlc_ram()
@ 2026-11-28 16:25 Nathan Chancellor
2026-11-30 16:58 ` Alex Deucher
0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2026-11-28 16:25 UTC (permalink / raw)
To: Alex Deucher, Christian König
Cc: Hawking Zhang, Frank Min, Likun Gao, amd-gfx, dri-devel, llvm,
Nathan Chancellor
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 <nathan@kernel.org>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu: Initialize data to NULL in imu_v13_0_program_rlc_ram()
2026-11-28 16:25 [PATCH] drm/amdgpu: Initialize data to NULL in imu_v13_0_program_rlc_ram() Nathan Chancellor
@ 2026-11-30 16:58 ` Alex Deucher
2026-11-30 19:56 ` Nathan Chancellor
0 siblings, 1 reply; 4+ messages in thread
From: Alex Deucher @ 2026-11-30 16:58 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Alex Deucher, Christian König, Hawking Zhang, Frank Min,
Likun Gao, amd-gfx, dri-devel, llvm
On Sat, Nov 28, 2026 at 11:26 AM Nathan Chancellor <nathan@kernel.org> 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 <nathan@kernel.org>
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu: Initialize data to NULL in imu_v13_0_program_rlc_ram()
2026-11-30 16:58 ` Alex Deucher
@ 2026-11-30 19:56 ` Nathan Chancellor
2026-11-30 20:03 ` Alex Deucher
0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2026-11-30 19:56 UTC (permalink / raw)
To: Alex Deucher
Cc: Alex Deucher, Christian König, Hawking Zhang, Frank Min,
Likun Gao, amd-gfx, dri-devel, llvm
On Mon, Nov 30, 2026 at 11:58:38AM -0500, Alex Deucher wrote:
> On Sat, Nov 28, 2026 at 11:26 AM Nathan Chancellor <nathan@kernel.org> 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 <nathan@kernel.org>
>
> I already squashed the identical change into the original patch last week.
Ah, my apologies. I used the tree that -next pulls in as a base (the
drm-next branch of your agd5f/linux.git) but I see now that the
drm-amdgpu-next branch of drm/amdgpu/kernel has the correction. Sorry
for the noise. I assume a sync will happen at some point to make this go
away for -next?
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu: Initialize data to NULL in imu_v13_0_program_rlc_ram()
2026-11-30 19:56 ` Nathan Chancellor
@ 2026-11-30 20:03 ` Alex Deucher
0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2026-11-30 20:03 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Alex Deucher, Christian König, Hawking Zhang, Frank Min,
Likun Gao, amd-gfx, dri-devel, llvm
On Mon, Nov 30, 2026 at 2:56 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Mon, Nov 30, 2026 at 11:58:38AM -0500, Alex Deucher wrote:
> > On Sat, Nov 28, 2026 at 11:26 AM Nathan Chancellor <nathan@kernel.org> 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 <nathan@kernel.org>
> >
> > I already squashed the identical change into the original patch last week.
>
> Ah, my apologies. I used the tree that -next pulls in as a base (the
> drm-next branch of your agd5f/linux.git) but I see now that the
> drm-amdgpu-next branch of drm/amdgpu/kernel has the correction. Sorry
> for the noise. I assume a sync will happen at some point to make this go
> away for -next?
Yes. Sorry. I forgot to update the agd5f/linux.git mirror when I
updated the drm/amdgpu branch. Will do it now.
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-30 20:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 16:25 [PATCH] drm/amdgpu: Initialize data to NULL in imu_v13_0_program_rlc_ram() Nathan Chancellor
2026-11-30 16:58 ` Alex Deucher
2026-11-30 19:56 ` Nathan Chancellor
2026-11-30 20:03 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.