]> git.karo-electronics.de Git - linux-beck.git/commitdiff
gpu: ion: fill in buffer->{dev,size} before mapping new buffers
authorGreg Hackmann <ghackmann@google.com>
Fri, 13 Dec 2013 22:23:45 +0000 (14:23 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2013 16:55:37 +0000 (08:55 -0800)
At least one map_dma() implementation (EXYNOS_CONTIG) assumes the fields
are filled in

Signed-off-by: Greg Hackmann <ghackmann@google.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion.c

index 7ff9983c8eb9280a7a0a891922520c81051197eb..552a86a94f61504e07dbd7af9e17230744d43f96 100644 (file)
@@ -151,6 +151,9 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
                return ERR_PTR(ret);
        }
 
+       buffer->dev = dev;
+       buffer->size = len;
+
        table = buffer->heap->ops->map_dma(buffer->heap, buffer);
        if (IS_ERR_OR_NULL(table)) {
                heap->ops->free(buffer);
@@ -159,8 +162,6 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
        }
        buffer->sg_table = table;
 
-       buffer->dev = dev;
-       buffer->size = len;
        mutex_init(&buffer->lock);
        ion_buffer_add(dev, buffer);
        return buffer;