aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_drawable.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_drawable.c')
-rw-r--r--drivers/gpu/drm/drm_drawable.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c
index 80be1cab62af..c53c9768cc11 100644
--- a/drivers/gpu/drm/drm_drawable.c
+++ b/drivers/gpu/drm/drm_drawable.c
@@ -85,9 +85,8 @@ int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
85 spin_unlock_irqrestore(&dev->drw_lock, irqflags); 85 spin_unlock_irqrestore(&dev->drw_lock, irqflags);
86 return -EINVAL; 86 return -EINVAL;
87 } 87 }
88 drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect), 88 kfree(info->rects);
89 DRM_MEM_BUFS); 89 kfree(info);
90 drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS);
91 90
92 idr_remove(&dev->drw_idr, draw->handle); 91 idr_remove(&dev->drw_idr, draw->handle);
93 92
@@ -106,12 +105,12 @@ int drm_update_drawable_info(struct drm_device *dev, void *data, struct drm_file
106 105
107 info = idr_find(&dev->drw_idr, update->handle); 106 info = idr_find(&dev->drw_idr, update->handle);
108 if (!info) { 107 if (!info) {
109 info = drm_calloc(1, sizeof(*info), DRM_MEM_BUFS); 108 info = kzalloc(sizeof(*info), GFP_KERNEL);
110 if (!info) 109 if (!info)
111 return -ENOMEM; 110 return -ENOMEM;
112 if (IS_ERR(idr_replace(&dev->drw_idr, info, update->handle))) { 111 if (IS_ERR(idr_replace(&dev->drw_idr, info, update->handle))) {
113 DRM_ERROR("No such drawable %d\n", update->handle); 112 DRM_ERROR("No such drawable %d\n", update->handle);
114 drm_free(info, sizeof(*info), DRM_MEM_BUFS); 113 kfree(info);
115 return -EINVAL; 114 return -EINVAL;
116 } 115 }
117 } 116 }
@@ -121,8 +120,9 @@ int drm_update_drawable_info(struct drm_device *dev, void *data, struct drm_file
121 if (update->num == 0) 120 if (update->num == 0)
122 rects = NULL; 121 rects = NULL;
123 else if (update->num != info->num_rects) { 122 else if (update->num != info->num_rects) {
124 rects = drm_alloc(update->num * sizeof(struct drm_clip_rect), 123 rects = kmalloc(update->num *
125 DRM_MEM_BUFS); 124 sizeof(struct drm_clip_rect),
125 GFP_KERNEL);
126 } else 126 } else
127 rects = info->rects; 127 rects = info->rects;
128 128
@@ -145,8 +145,7 @@ int drm_update_drawable_info(struct drm_device *dev, void *data, struct drm_file
145 spin_lock_irqsave(&dev->drw_lock, irqflags); 145 spin_lock_irqsave(&dev->drw_lock, irqflags);
146 146
147 if (rects != info->rects) { 147 if (rects != info->rects) {
148 drm_free(info->rects, info->num_rects * 148 kfree(info->rects);
149 sizeof(struct drm_clip_rect), DRM_MEM_BUFS);
150 } 149 }
151 150
152 info->rects = rects; 151 info->rects = rects;
@@ -166,8 +165,7 @@ int drm_update_drawable_info(struct drm_device *dev, void *data, struct drm_file
166 165
167error: 166error:
168 if (rects != info->rects) 167 if (rects != info->rects)
169 drm_free(rects, update->num * sizeof(struct drm_clip_rect), 168 kfree(rects);
170 DRM_MEM_BUFS);
171 169
172 return err; 170 return err;
173} 171}
@@ -186,9 +184,8 @@ static int drm_drawable_free(int idr, void *p, void *data)
186 struct drm_drawable_info *info = p; 184 struct drm_drawable_info *info = p;
187 185
188 if (info) { 186 if (info) {
189 drm_free(info->rects, info->num_rects * 187 kfree(info->rects);
190 sizeof(struct drm_clip_rect), DRM_MEM_BUFS); 188 kfree(info);
191 drm_free(info, sizeof(*info), DRM_MEM_BUFS);
192 } 189 }
193 190
194 return 0; 191 return 0;