drm: Use a flexible array member for blob property data
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 13 Mar 2012 10:35:49 +0000 (12:35 +0200)
committerDave Airlie <airlied@redhat.com>
Thu, 15 Mar 2012 09:52:37 +0000 (09:52 +0000)
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>
drivers/gpu/drm/drm_crtc.c
include/drm/drm_crtc.h

index f5b098e50bb1f116e28fa4bf2d5f5a07e6980250..d2d9dc52ac892464d19317d4d1aa1cf6bba2595b 100644 (file)
@@ -2943,7 +2943,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 00f4007a6d04fc5745d9aac94dac067f464e3beb..53cb49a13e17049900cac64559d5d47a46f914c4 100644 (file)
@@ -257,7 +257,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 {