Message ID | 1521163214-13521-4-git-send-email-james.xiong@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 2fcb0a0..f8317a4 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -402,11 +402,10 @@ drm_intel_gem_bo_bucket_for_size(drm_intel_bufmgr_gem *bufmgr_gem, { int i; - for (i = 0; i < bufmgr_gem->num_buckets; i++) { - struct drm_intel_gem_bo_bucket *bucket = - &bufmgr_gem->cache_bucket[i]; - if (bucket->size >= size) { - return bucket; + for (i = 0; i < bufmgr_gem->num_buckets - 1; i++) { + if (size >= bufmgr_gem->cache_bucket[i].size && + size < bufmgr_gem->cache_bucket[i+1].size) { + return &bufmgr_gem->cache_bucket[i]; } }