msm: kgsl: Fix the return value of kgsl_active_count_wait()
kgsl_active_count_wait() is very badly crafted. If the active count is already under the threshold (as it often is - a successful condition) the conditional at the end of the function returns -ETIMEDOUT instead of 0. Return the proper error value so the caller can make a wise decision based on the result. Change-Id: Ic0dedbadb948820cf64e3131f895fa3d15247cac Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
@@ -1631,17 +1631,19 @@ static int _check_active_count(struct kgsl_device *device, int count)
|
||||
*/
|
||||
int kgsl_active_count_wait(struct kgsl_device *device, int count)
|
||||
{
|
||||
int ret = 0;
|
||||
int result = 0;
|
||||
|
||||
BUG_ON(!mutex_is_locked(&device->mutex));
|
||||
|
||||
if (atomic_read(&device->active_cnt) > count) {
|
||||
int ret;
|
||||
mutex_unlock(&device->mutex);
|
||||
ret = wait_event_timeout(device->active_cnt_wq,
|
||||
_check_active_count(device, count), HZ);
|
||||
mutex_lock(&device->mutex);
|
||||
result = ret == 0 ? -ETIMEDOUT : 0;
|
||||
}
|
||||
|
||||
return ret == 0 ? -ETIMEDOUT : 0;
|
||||
return result;
|
||||
}
|
||||
EXPORT_SYMBOL(kgsl_active_count_wait);
|
||||
|
||||
Reference in New Issue
Block a user