Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: check return for setting engine dram timings

This resolves the unchecded return value warning reported by Coverity.

Signed-off-by: Tim Huang <tim.huang@amd.com>
Reviewed-by: Jesse Zhang <jesse.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Tim Huang and committed by
Alex Deucher
381ec816 5839d27d

+11 -9
+4 -4
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
··· 1145 1145 return 0; 1146 1146 } 1147 1147 1148 - void amdgpu_atombios_set_engine_dram_timings(struct amdgpu_device *adev, 1149 - u32 eng_clock, u32 mem_clock) 1148 + int amdgpu_atombios_set_engine_dram_timings(struct amdgpu_device *adev, 1149 + u32 eng_clock, u32 mem_clock) 1150 1150 { 1151 1151 SET_ENGINE_CLOCK_PS_ALLOCATION args; 1152 1152 int index = GetIndexIntoMasterTable(COMMAND, DynamicMemorySettings); ··· 1161 1161 if (mem_clock) 1162 1162 args.sReserved.ulClock = cpu_to_le32(mem_clock & SET_CLOCK_FREQ_MASK); 1163 1163 1164 - amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args, 1165 - sizeof(args)); 1164 + return amdgpu_atom_execute_table(adev->mode_info.atom_context, index, 1165 + (uint32_t *)&args, sizeof(args)); 1166 1166 } 1167 1167 1168 1168 void amdgpu_atombios_get_default_voltages(struct amdgpu_device *adev,
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h
··· 163 163 bool strobe_mode, 164 164 struct atom_mpll_param *mpll_param); 165 165 166 - void amdgpu_atombios_set_engine_dram_timings(struct amdgpu_device *adev, 167 - u32 eng_clock, u32 mem_clock); 166 + int amdgpu_atombios_set_engine_dram_timings(struct amdgpu_device *adev, 167 + u32 eng_clock, u32 mem_clock); 168 168 169 169 bool 170 170 amdgpu_atombios_is_voltage_gpio(struct amdgpu_device *adev,
+5 -3
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c
··· 4755 4755 u32 dram_timing; 4756 4756 u32 dram_timing2; 4757 4757 u32 burst_time; 4758 + int ret; 4758 4759 4759 4760 arb_regs->mc_arb_rfsh_rate = 4760 4761 (u8)si_calculate_memory_refresh_rate(adev, pl->sclk); 4761 4762 4762 - amdgpu_atombios_set_engine_dram_timings(adev, 4763 - pl->sclk, 4764 - pl->mclk); 4763 + ret = amdgpu_atombios_set_engine_dram_timings(adev, pl->sclk, 4764 + pl->mclk); 4765 + if (ret) 4766 + return ret; 4765 4767 4766 4768 dram_timing = RREG32(MC_ARB_DRAM_TIMING); 4767 4769 dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2);