@@ -243,7 +243,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)
struct drm_device *dev = obj->dev;
struct omap_gem_object *omap_obj = to_omap_bo(obj);
struct page **pages;
- int npages = obj->size >> PAGE_SHIFT;
+ int npages;
int i, ret;
dma_addr_t *addrs;
@@ -255,6 +255,8 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)
return PTR_ERR(pages);
}
+ npages = obj->size >> PAGE_SHIFT;
+
/* for non-cached buffers, ensure the new pages are clean because
* DSS, GPU, etc. are not cache coherent:
*/