]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
drm/radeon: signedness bug in kv_dpm.c
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 4 Sep 2013 09:31:36 +0000 (12:31 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 11 Sep 2013 15:44:27 +0000 (11:44 -0400)
commit8c5c6fad61f9540a977e5731a8ae3bd8ba9083cb
treebadcd9d2600c330c1ca93238511175106c116c53
parent41cd0b3b78d83ae87ee71cca2de5498f93816763
drm/radeon: signedness bug in kv_dpm.c

The problem here is that "unsigned i" is always greater than or equal to
zero.  These loops mostly have a second check for "(i == 0)" so only the
last two are actually buggy.  The rest is just cleanup.

Bug 1:  kv_force_dpm_highest() doesn't have an "(i == 0)" check so it's
a potential forever loop.

Bug 2: In kv_get_sleep_divider_id_from_clock() there is a typo and the
test is reversed "<=" vs ">" so we never enter the loop.  That means
normally we return KV_MAX_DEEPSLEEP_DIVIDER_ID (5).  The return value
from here is saved in ->DeepSleepDivId and I wasn't able to determine
how that is used.  This is a static checker fix and I have not tested
it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/kv_dpm.c