Merge drm/drm-next into drm-misc-next
[sfrench/cifs-2.6.git] / drivers / gpu / drm / nouveau / nouveau_bo.c
index 50ee9d73006686f91df33008b288bd16c628f7a5..56dcd25db1ce2c79b8a6be7c0ea684838e74e655 100644 (file)
@@ -325,8 +325,9 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
                            (!vmm->page[i].host || vmm->page[i].shift > PAGE_SHIFT))
                                continue;
 
-                       if (pi < 0)
-                               pi = i;
+                       /* pick the last one as it will be smallest. */
+                       pi = i;
+
                        /* Stop once the buffer is larger than the current page size. */
                        if (*size >= 1ULL << vmm->page[i].shift)
                                break;