]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amd/powerplay: return false instead of -EINVAL
authorAndrew Shadura <andrew.shadura@collabora.co.uk>
Thu, 3 Nov 2016 10:09:24 +0000 (11:09 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 8 Nov 2016 16:43:05 +0000 (11:43 -0500)
commitf1bd0c1f43c0728fb165e97f167bbc77c5b4277d
tree06c1d953c21517bc4dc9e37b1cc00a315854fa36
parent8a55416f8cbd819b7125a2dfe9819aec5341be00
drm/amd/powerplay: return false instead of -EINVAL

Returning -EINVAL from a bool-returning function
phm_check_smc_update_required_for_display_configuration has an unexpected
effect of returning true, which is probably not what was intended.
Replace -EINVAL by false.

The only place this function is called from is
psm_adjust_power_state_dynamic in
drivers/gpu/drm/amd/powerplay/eventmgr/psm.c:106:

if (!equal || phm_check_smc_update_required_for_display_configuration(hwmgr)) {
phm_apply_state_adjust_rules(hwmgr, requested, pcurrent);
phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware);
hwmgr->current_ps = requested;
}

It seems to expect a boolean value here.

This issue has been found using the following Coccinelle semantic patch
written by Peter Senna Tschudin:
<smpl>
@@
identifier f;
constant C;
typedef bool;
@@
bool f (...){
<+...
* return -C;
...+>
}
</smpl>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c