Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b45541d authored by Mykola Lysenko's avatar Mykola Lysenko Committed by Alex Deucher
Browse files

drm/amdgpu: fix memory leak in CGS (FW info)



Previously requested FW pointer should not be
overwritten on a subsequent call.

Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarMykola Lysenko <Mykola.Lysenko@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b0d11345
Loading
Loading
Loading
Loading
+36 −34
Original line number Diff line number Diff line
@@ -735,6 +735,7 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
		const uint8_t *src;
		const struct smc_firmware_header_v1_0 *hdr;

		if (!adev->pm.fw) {
			switch (adev->asic_type) {
			case CHIP_TONGA:
				strcpy(fw_name, "amdgpu/tonga_smc.bin");
@@ -772,6 +773,7 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
				adev->pm.fw = NULL;
				return err;
			}
		}

		hdr = (const struct smc_firmware_header_v1_0 *)	adev->pm.fw->data;
		adev->pm.fw_version = le32_to_cpu(hdr->header.ucode_version);