From: Bob Gleitsmann Date: Mon, 21 Dec 2009 03:52:09 +0000 (+1000) Subject: drm/mm: fix logic for selection of best fit block X-Git-Tag: MMI-PSA29.97-13-9~25013^2~60 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e2108eb1f66d77b4af77caf282cab1d47e3f4831;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git drm/mm: fix logic for selection of best fit block This is from bug 25728. [airlied: I'm just forwarding the patch for review, Thomas, ickle?] Acked-by: Jerome Glisse Acked-by: Thomas Hellstrom Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index d7d7eac3ddd2..cdec32977129 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c @@ -358,7 +358,7 @@ struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, if (entry->size >= size + wasted) { if (!best_match) return entry; - if (size < best_size) { + if (entry->size < best_size) { best = entry; best_size = entry->size; } @@ -408,7 +408,7 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm, if (entry->size >= size + wasted) { if (!best_match) return entry; - if (size < best_size) { + if (entry->size < best_size) { best = entry; best_size = entry->size; }