re: drm/amd/powerplay: add hardware manager sub-component

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jammy Zhou,

The powerplay patches introduce a lot of Smatch static checker warnings.
I started to fix them but there are quite a few so I decided to just
pass them back to you instead.

They're mostly about small mistakes with indenting or return -1 instead
of -ENOMEM.  There are a ball of places where NULL checks are reversed
or && was used instead of ||.  Also an unreachable code warning.  The
struct type mismatch warnings should probably be addressed as well.
Actually it should all be fixed really, even though the bad indenting is
harmless.  Maybe add a /* fall through */ comment for the missing break
warnings, it looks like that was intentional.  The buffer overflow
warnings are because the test is off-by-one.

Feel free to ask if you have any questions.

regards,
dan carpenter

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:806 amdgpu_pm_compute_clocks() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:231 fiji_send_msg_to_smc() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:560 fiji_request_smu_specific_fw_load() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:726 fiji_start_avfs_btc() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:1036 fiji_smum_init() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/cz_smumgr.c:201 cz_check_fw_load_finish() info: ignoring unreachable code.
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/tonga_smumgr.c:813 tonga_smum_init() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/processpptables.c:397 get_clock_voltage_dependency_table() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/processpptables.c:1330 get_cac_leakage_table() error: potential null dereference 'cac_leakage_table'.  (kzalloc returns null)
include/linux/compiler.h:231 get_platform_power_management_table() warn: struct type mismatch 'phm_ppm_table vs _ATOM_PPLIB_PPM_Table'
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/processpptables.c:1469 init_phase_shedding_table() error: potential null dereference 'table'.  (kzalloc returns null)
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/functiontables.c:69 phm_dispatch_table() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/functiontables.c:106 phm_construct_table() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_powertune.c:549 fiji_power_control_set_level() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_powertune.c:552 fiji_power_control_set_level() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/ppevvmath.h:575 uGetScaledDecimal() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_processpptables.c:171 get_vddc_lookup_table() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_processpptables.c:204 get_platform_power_management_table() warn: struct type mismatch 'phm_ppm_table vs _ATOM_Tonga_PPM_Table'
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_processpptables.c:209 get_platform_power_management_table() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_processpptables.c:330 get_valid_clk() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_processpptables.c:381 get_mclk_voltage_dependency_table() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_processpptables.c:424 get_sclk_voltage_dependency_table() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_processpptables.c:467 get_pcie_table() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_processpptables.c:509 get_cac_tdp_table() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_processpptables.c:516 get_cac_tdp_table() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_processpptables.c:617 get_mm_clock_voltage_table() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/cz_hwmgr.c:582 cz_tf_init_sclk_limit() error: we previously assumed 'table' could be null (see line 582)
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/cz_hwmgr.c:609 cz_tf_init_uvd_limit() error: we previously assumed 'table' could be null (see line 609)
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/cz_hwmgr.c:637 cz_tf_init_vce_limit() error: we previously assumed 'table' could be null (see line 637)
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/cz_hwmgr.c:665 cz_tf_init_acp_limit() error: we previously assumed 'table' could be null (see line 665)
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/cz_hwmgr.c:1158 cz_hwmgr_backend_fini() error: we previously assumed 'hwmgr' could be null (see line 1158)
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/cz_hwmgr.c:1186 cz_phm_unforce_dpm_levels() error: we previously assumed 'table' could be null (see line 1186)
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/cz_hwmgr.c:1640 cz_get_dal_power_level() warn: why is zero skipped 'i'
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/hardwaremanager.c:257 phm_check_smc_update_required_for_display_configuration() warn: signedness bug returning '(-22)'
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/hardwaremanager.c:260 phm_check_smc_update_required_for_display_configuration() warn: signedness bug returning '(-22)'
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_hwmgr.c:697 fiji_hwmgr_backend_init() error: we previously assumed 'table_info' could be null (see line 652)
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_hwmgr.c:944 fiji_trim_voltage_table() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_hwmgr.c:1161 fiji_program_static_screen_threshold_parameters() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_hwmgr.c:1298 fiji_process_firmware_header() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_hwmgr.c:1342 fiji_copy_and_switch_arb_sets() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_hwmgr.c:3323 fiji_start_dpm() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_hwmgr.c:3558 fiji_apply_dal_min_voltage_request() error: we previously assumed 'table' could be null (see line 3554)
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/fiji_hwmgr.c:4157 fiji_request_link_speed_change_before_state_change() warn: missing break? reassigning 'data->force_pcie_gen'
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_hwmgr.c:1683 tonga_populate_smc_uvd_level() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_hwmgr.c:3927 tonga_set_mc_special_registers() error: buffer overflow 'table->mc_reg_address' 16 <= 16
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_hwmgr.c:3928 tonga_set_mc_special_registers() error: buffer overflow 'table->mc_reg_address' 16 <= 16
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_hwmgr.c:3930 tonga_set_mc_special_registers() error: buffer overflow 'table->mc_reg_table_entry[k]->mc_data' 16 <= 16
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_hwmgr.c:3992 tonga_initialize_mc_reg_table() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_hwmgr.c:5735 tonga_set_max_fan_pwm_output() warn: inconsistent indenting
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_hwmgr.c:5965 tonga_check_states_equal() warn: variable dereferenced before check 'pstate1' (see line 5961)
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/tonga_hwmgr.c:5965 tonga_check_states_equal() warn: variable dereferenced before check 'pstate2' (see line 5962)
drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c:76 pp_sw_fini() error: we previously assumed 'hwmgr' could be null (see line 76)
drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c:77 pp_sw_fini() error: we previously assumed 'hwmgr->hwmgr_func' could be null (see line 76)
drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c:136 pp_hw_fini() error: we previously assumed 'eventmgr' could be null (see line 136)
drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c:141 pp_hw_fini() error: we previously assumed 'smumgr' could be null (see line 141)
drivers/gpu/drm/amd/amdgpu/../powerplay/amd_powerplay.c:142 pp_hw_fini() error: we previously assumed 'smumgr->smumgr_funcs' could be null (see line 141)
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux