diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_irq.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index d6010135e40..dd49046bccd 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -888,20 +888,20 @@ i915_error_object_create(struct drm_i915_private *dev_priv, | |||
888 | struct drm_i915_gem_object *src) | 888 | struct drm_i915_gem_object *src) |
889 | { | 889 | { |
890 | struct drm_i915_error_object *dst; | 890 | struct drm_i915_error_object *dst; |
891 | int page, page_count; | 891 | int i, count; |
892 | u32 reloc_offset; | 892 | u32 reloc_offset; |
893 | 893 | ||
894 | if (src == NULL || src->pages == NULL) | 894 | if (src == NULL || src->pages == NULL) |
895 | return NULL; | 895 | return NULL; |
896 | 896 | ||
897 | page_count = src->base.size / PAGE_SIZE; | 897 | count = src->base.size / PAGE_SIZE; |
898 | 898 | ||
899 | dst = kmalloc(sizeof(*dst) + page_count * sizeof(u32 *), GFP_ATOMIC); | 899 | dst = kmalloc(sizeof(*dst) + count * sizeof(u32 *), GFP_ATOMIC); |
900 | if (dst == NULL) | 900 | if (dst == NULL) |
901 | return NULL; | 901 | return NULL; |
902 | 902 | ||
903 | reloc_offset = src->gtt_offset; | 903 | reloc_offset = src->gtt_offset; |
904 | for (page = 0; page < page_count; page++) { | 904 | for (i = 0; i < count; i++) { |
905 | unsigned long flags; | 905 | unsigned long flags; |
906 | void *d; | 906 | void *d; |
907 | 907 | ||
@@ -924,30 +924,33 @@ i915_error_object_create(struct drm_i915_private *dev_priv, | |||
924 | memcpy_fromio(d, s, PAGE_SIZE); | 924 | memcpy_fromio(d, s, PAGE_SIZE); |
925 | io_mapping_unmap_atomic(s); | 925 | io_mapping_unmap_atomic(s); |
926 | } else { | 926 | } else { |
927 | struct page *page; | ||
927 | void *s; | 928 | void *s; |
928 | 929 | ||
929 | drm_clflush_pages(&src->pages[page], 1); | 930 | page = i915_gem_object_get_page(src, i); |
931 | |||
932 | drm_clflush_pages(&page, 1); | ||
930 | 933 | ||
931 | s = kmap_atomic(src->pages[page]); | 934 | s = kmap_atomic(page); |
932 | memcpy(d, s, PAGE_SIZE); | 935 | memcpy(d, s, PAGE_SIZE); |
933 | kunmap_atomic(s); | 936 | kunmap_atomic(s); |
934 | 937 | ||
935 | drm_clflush_pages(&src->pages[page], 1); | 938 | drm_clflush_pages(&page, 1); |
936 | } | 939 | } |
937 | local_irq_restore(flags); | 940 | local_irq_restore(flags); |
938 | 941 | ||
939 | dst->pages[page] = d; | 942 | dst->pages[i] = d; |
940 | 943 | ||
941 | reloc_offset += PAGE_SIZE; | 944 | reloc_offset += PAGE_SIZE; |
942 | } | 945 | } |
943 | dst->page_count = page_count; | 946 | dst->page_count = count; |
944 | dst->gtt_offset = src->gtt_offset; | 947 | dst->gtt_offset = src->gtt_offset; |
945 | 948 | ||
946 | return dst; | 949 | return dst; |
947 | 950 | ||
948 | unwind: | 951 | unwind: |
949 | while (page--) | 952 | while (i--) |
950 | kfree(dst->pages[page]); | 953 | kfree(dst->pages[i]); |
951 | kfree(dst); | 954 | kfree(dst); |
952 | return NULL; | 955 | return NULL; |
953 | } | 956 | } |