Skip to contentSkip to conversation

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu_helper.c:663 smu_set_watermarks_for_clocks_ranges() error: we previously assumed 'wm_with_clock_ranges' could be null (see line 660)

PATCH New Dan Carpenter 1 participant 1 message Apr 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 170/201 drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu_helper.c:663 smu_set_watermarks_for_clocks_ranges() error: we previously assumed 'wm_with_clock_ranges' could be null (see line 660)

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   d64547a1cfa860e241b27723c88f86fa3d88d3d7
commit: d6c9a7dc86cd39146afb0f47c06b6f95d7dd4997 [170/201] drm/amd/pp: Move common code to smu_helper.c

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu_helper.c:663 smu_set_watermarks_for_clocks_ranges() error: we previously assumed 'wm_with_clock_ranges' could be null (see line 660)

git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git remote update radeon-alex
git checkout d6c9a7dc86cd39146afb0f47c06b6f95d7dd4997
vim +/wm_with_clock_ranges +663 drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu_helper.c

d6c9a7dc Rex Zhu 2018-04-08  653  
d6c9a7dc Rex Zhu 2018-04-08  654  int smu_set_watermarks_for_clocks_ranges(void *wt_table,
d6c9a7dc Rex Zhu 2018-04-08  655  		struct pp_wm_sets_with_clock_ranges_soc15 *wm_with_clock_ranges)
d6c9a7dc Rex Zhu 2018-04-08  656  {
d6c9a7dc Rex Zhu 2018-04-08  657  	uint32_t i;
d6c9a7dc Rex Zhu 2018-04-08  658  	struct watermarks *table = wt_table;
d6c9a7dc Rex Zhu 2018-04-08  659  
d6c9a7dc Rex Zhu 2018-04-08 @660  	if (!table || wm_with_clock_ranges)
                                                      ^^^^^^^^^^^^^^^^^^^^

This test is inverted. We should be checking if it's NULL not non-NULL.

d6c9a7dc Rex Zhu 2018-04-08 661 return -EINVAL;
d6c9a7dc Rex Zhu 2018-04-08 662
d6c9a7dc Rex Zhu 2018-04-08 @663 if (wm_with_clock_ranges->num_wm_sets_dmif > 4 || wm_with_clock_ranges->num_wm_sets_mcif > 4)