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)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 27 Feb 2024 16:06:58 +0000 (11:06 -0500)
commiteb4f139888f636614dab3bcce97ff61cefc4b3a7
tree67876c5e06c752d92d98ff1daad9519a17478e2e
parent7cf1ad2fe10634238b38442a851d89514cb14ea2
drm/amd/amdgpu: Fix potential ioremap() memory leaks in amdgpu_device_init()

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>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c