]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/amd/amdgpu: Fix potential ioremap() memory leaks in amdgpu_device_init()
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Fri, 23 Feb 2024 11:38:16 +0000 (17:08 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Apr 2024 11:07:36 +0000 (13:07 +0200)
commit09d4600b9e99faf1c13d8ddadc01f9be966f2323
tree508d1e129feb639db17ccfe0baf6f5e0279bbfed
parent0f09e89e667ee71e6d7c9b124555aeb7f1fbfc16
drm/amd/amdgpu: Fix potential ioremap() memory leaks in amdgpu_device_init()

[ Upstream commit eb4f139888f636614dab3bcce97ff61cefc4b3a7 ]

This ensures that the memory mapped by ioremap for adev->rmmio, is
properly handled in amdgpu_device_init(). If the function exits early
due to an error, the memory is unmapped. If the function completes
successfully, the memory remains mapped.

Reported by smatch:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:4337 amdgpu_device_init() warn: 'adev->rmmio' from ioremap() not released on lines: 4035,4045,4051,4058,4068,4337

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c