]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
drm: Set cliprects to NULL when changing drawable to having 0 cliprects.
authorZhenyu Wang <zhenyu.z.wang@intel.com>
Fri, 17 Oct 2008 05:15:48 +0000 (13:15 +0800)
committerDave Airlie <airlied@redhat.com>
Thu, 23 Oct 2008 03:42:26 +0000 (13:42 +1000)
This avoids setting the cliprects pointer to a zero-sized allocation.

Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_drawable.c

index 1839c57663c550e5a487df49b4d040c40e582074..70b15d1b8f545e3ebe0e3c9eb2f54c88b6a8f75f 100644 (file)
@@ -111,7 +111,9 @@ int drm_update_drawable_info(struct drm_device *dev, void *data, struct drm_file
 
        switch (update->type) {
        case DRM_DRAWABLE_CLIPRECTS:
-               if (update->num != info->num_rects) {
+               if (update->num == 0)
+                       rects = NULL;
+               else if (update->num != info->num_rects) {
                        rects = drm_alloc(update->num * sizeof(struct drm_clip_rect),
                                         DRM_MEM_BUFS);
                } else