Commit 75e1658e authored by Nirmoy Das's avatar Nirmoy Das Committed by Alex Deucher

drm/amdgpu: call release_firmware() without a NULL check

The release_firmware() function is NULL tolerant so we do not need
to check for NULL param before calling it.
Signed-off-by: default avatarNirmoy Das <nirmoy.das@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d69fd951
...@@ -3380,10 +3380,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev) ...@@ -3380,10 +3380,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
amdgpu_pm_sysfs_fini(adev); amdgpu_pm_sysfs_fini(adev);
amdgpu_fbdev_fini(adev); amdgpu_fbdev_fini(adev);
r = amdgpu_device_ip_fini(adev); r = amdgpu_device_ip_fini(adev);
if (adev->firmware.gpu_info_fw) { release_firmware(adev->firmware.gpu_info_fw);
release_firmware(adev->firmware.gpu_info_fw); adev->firmware.gpu_info_fw = NULL;
adev->firmware.gpu_info_fw = NULL;
}
adev->accel_working = false; adev->accel_working = false;
/* free i2c buses */ /* free i2c buses */
if (!amdgpu_device_has_dc_support(adev)) if (!amdgpu_device_has_dc_support(adev))
......
...@@ -196,10 +196,8 @@ static int psp_sw_fini(void *handle) ...@@ -196,10 +196,8 @@ static int psp_sw_fini(void *handle)
adev->psp.sos_fw = NULL; adev->psp.sos_fw = NULL;
release_firmware(adev->psp.asd_fw); release_firmware(adev->psp.asd_fw);
adev->psp.asd_fw = NULL; adev->psp.asd_fw = NULL;
if (adev->psp.ta_fw) { release_firmware(adev->psp.ta_fw);
release_firmware(adev->psp.ta_fw); adev->psp.ta_fw = NULL;
adev->psp.ta_fw = NULL;
}
if (adev->asic_type == CHIP_NAVI10) if (adev->asic_type == CHIP_NAVI10)
psp_sysfs_fini(adev); psp_sysfs_fini(adev);
......
...@@ -559,8 +559,8 @@ static void sdma_v4_0_destroy_inst_ctx(struct amdgpu_device *adev) ...@@ -559,8 +559,8 @@ static void sdma_v4_0_destroy_inst_ctx(struct amdgpu_device *adev)
int i; int i;
for (i = 0; i < adev->sdma.num_instances; i++) { for (i = 0; i < adev->sdma.num_instances; i++) {
if (adev->sdma.instance[i].fw != NULL) release_firmware(adev->sdma.instance[i].fw);
release_firmware(adev->sdma.instance[i].fw); adev->sdma.instance[i].fw = NULL;
/* arcturus shares the same FW memory across /* arcturus shares the same FW memory across
all SDMA isntances */ all SDMA isntances */
......
...@@ -1300,8 +1300,8 @@ static int sdma_v5_0_sw_fini(void *handle) ...@@ -1300,8 +1300,8 @@ static int sdma_v5_0_sw_fini(void *handle)
int i; int i;
for (i = 0; i < adev->sdma.num_instances; i++) { for (i = 0; i < adev->sdma.num_instances; i++) {
if (adev->sdma.instance[i].fw != NULL) release_firmware(adev->sdma.instance[i].fw);
release_firmware(adev->sdma.instance[i].fw); adev->sdma.instance[i].fw = NULL;
amdgpu_ring_fini(&adev->sdma.instance[i].ring); amdgpu_ring_fini(&adev->sdma.instance[i].ring);
} }
......
...@@ -115,8 +115,8 @@ static void sdma_v5_2_destroy_inst_ctx(struct amdgpu_device *adev) ...@@ -115,8 +115,8 @@ static void sdma_v5_2_destroy_inst_ctx(struct amdgpu_device *adev)
int i; int i;
for (i = 0; i < adev->sdma.num_instances; i++) { for (i = 0; i < adev->sdma.num_instances; i++) {
if (adev->sdma.instance[i].fw != NULL) release_firmware(adev->sdma.instance[i].fw);
release_firmware(adev->sdma.instance[i].fw); adev->sdma.instance[i].fw = NULL;
if (adev->asic_type == CHIP_SIENNA_CICHLID) if (adev->asic_type == CHIP_SIENNA_CICHLID)
break; break;
......
...@@ -1318,15 +1318,11 @@ static int dm_sw_fini(void *handle) ...@@ -1318,15 +1318,11 @@ static int dm_sw_fini(void *handle)
adev->dm.dmub_srv = NULL; adev->dm.dmub_srv = NULL;
} }
if (adev->dm.dmub_fw) { release_firmware(adev->dm.dmub_fw);
release_firmware(adev->dm.dmub_fw); adev->dm.dmub_fw = NULL;
adev->dm.dmub_fw = NULL;
}
if(adev->dm.fw_dmcu) { release_firmware(adev->dm.fw_dmcu);
release_firmware(adev->dm.fw_dmcu); adev->dm.fw_dmcu = NULL;
adev->dm.fw_dmcu = NULL;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment