drm: Use a flexible array member for blob property data
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 20 Mar 2012 14:46:14 +0000 (16:46 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:30:41 +0000 (12:30 +0300)
The blob property data is always allocated immediately after the object
header. No need for the extra indirection when accessing it, just use
a flexible array member.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
drivers/gpu/drm/drm_crtc.c
include/drm/drm_crtc.h

index 7a5b2ec..e1cd5ed 100644 (file)
@@ -3218,7 +3218,6 @@ static struct drm_property_blob *drm_property_create_blob(struct drm_device *dev
                return NULL;
        }
 
-       blob->data = (void *)((char *)blob + sizeof(struct drm_property_blob));
        blob->length = length;
 
        memcpy(blob->data, data, length);
index fa0ded1..28026e5 100644 (file)
@@ -256,7 +256,7 @@ struct drm_property_blob {
        struct drm_mode_object base;
        struct list_head head;
        unsigned int length;
-       void *data;
+       unsigned char data[];
 };
 
 struct drm_property_enum {