aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/radeon_mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/radeon_mem.c')
-rw-r--r--drivers/char/drm/radeon_mem.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/char/drm/radeon_mem.c b/drivers/char/drm/radeon_mem.c
index 517cad8b6e3a..df5b2e0bea33 100644
--- a/drivers/char/drm/radeon_mem.c
+++ b/drivers/char/drm/radeon_mem.c
@@ -137,12 +137,12 @@ static int init_heap(struct mem_block **heap, int start, int size)
137 struct mem_block *blocks = drm_alloc(sizeof(*blocks), DRM_MEM_BUFS); 137 struct mem_block *blocks = drm_alloc(sizeof(*blocks), DRM_MEM_BUFS);
138 138
139 if (!blocks) 139 if (!blocks)
140 return DRM_ERR(ENOMEM); 140 return -ENOMEM;
141 141
142 *heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFS); 142 *heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFS);
143 if (!*heap) { 143 if (!*heap) {
144 drm_free(blocks, sizeof(*blocks), DRM_MEM_BUFS); 144 drm_free(blocks, sizeof(*blocks), DRM_MEM_BUFS);
145 return DRM_ERR(ENOMEM); 145 return -ENOMEM;
146 } 146 }
147 147
148 blocks->start = start; 148 blocks->start = start;
@@ -226,7 +226,7 @@ int radeon_mem_alloc(DRM_IOCTL_ARGS)
226 226
227 if (!dev_priv) { 227 if (!dev_priv) {
228 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 228 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
229 return DRM_ERR(EINVAL); 229 return -EINVAL;
230 } 230 }
231 231
232 DRM_COPY_FROM_USER_IOCTL(alloc, (drm_radeon_mem_alloc_t __user *) data, 232 DRM_COPY_FROM_USER_IOCTL(alloc, (drm_radeon_mem_alloc_t __user *) data,
@@ -234,7 +234,7 @@ int radeon_mem_alloc(DRM_IOCTL_ARGS)
234 234
235 heap = get_heap(dev_priv, alloc.region); 235 heap = get_heap(dev_priv, alloc.region);
236 if (!heap || !*heap) 236 if (!heap || !*heap)
237 return DRM_ERR(EFAULT); 237 return -EFAULT;
238 238
239 /* Make things easier on ourselves: all allocations at least 239 /* Make things easier on ourselves: all allocations at least
240 * 4k aligned. 240 * 4k aligned.
@@ -245,11 +245,11 @@ int radeon_mem_alloc(DRM_IOCTL_ARGS)
245 block = alloc_block(*heap, alloc.size, alloc.alignment, filp); 245 block = alloc_block(*heap, alloc.size, alloc.alignment, filp);
246 246
247 if (!block) 247 if (!block)
248 return DRM_ERR(ENOMEM); 248 return -ENOMEM;
249 249
250 if (DRM_COPY_TO_USER(alloc.region_offset, &block->start, sizeof(int))) { 250 if (DRM_COPY_TO_USER(alloc.region_offset, &block->start, sizeof(int))) {
251 DRM_ERROR("copy_to_user\n"); 251 DRM_ERROR("copy_to_user\n");
252 return DRM_ERR(EFAULT); 252 return -EFAULT;
253 } 253 }
254 254
255 return 0; 255 return 0;
@@ -264,7 +264,7 @@ int radeon_mem_free(DRM_IOCTL_ARGS)
264 264
265 if (!dev_priv) { 265 if (!dev_priv) {
266 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 266 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
267 return DRM_ERR(EINVAL); 267 return -EINVAL;
268 } 268 }
269 269
270 DRM_COPY_FROM_USER_IOCTL(memfree, (drm_radeon_mem_free_t __user *) data, 270 DRM_COPY_FROM_USER_IOCTL(memfree, (drm_radeon_mem_free_t __user *) data,
@@ -272,14 +272,14 @@ int radeon_mem_free(DRM_IOCTL_ARGS)
272 272
273 heap = get_heap(dev_priv, memfree.region); 273 heap = get_heap(dev_priv, memfree.region);
274 if (!heap || !*heap) 274 if (!heap || !*heap)
275 return DRM_ERR(EFAULT); 275 return -EFAULT;
276 276
277 block = find_block(*heap, memfree.region_offset); 277 block = find_block(*heap, memfree.region_offset);
278 if (!block) 278 if (!block)
279 return DRM_ERR(EFAULT); 279 return -EFAULT;
280 280
281 if (block->filp != filp) 281 if (block->filp != filp)
282 return DRM_ERR(EPERM); 282 return -EPERM;
283 283
284 free_block(block); 284 free_block(block);
285 return 0; 285 return 0;
@@ -294,7 +294,7 @@ int radeon_mem_init_heap(DRM_IOCTL_ARGS)
294 294
295 if (!dev_priv) { 295 if (!dev_priv) {
296 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 296 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
297 return DRM_ERR(EINVAL); 297 return -EINVAL;
298 } 298 }
299 299
300 DRM_COPY_FROM_USER_IOCTL(initheap, 300 DRM_COPY_FROM_USER_IOCTL(initheap,
@@ -303,11 +303,11 @@ int radeon_mem_init_heap(DRM_IOCTL_ARGS)
303 303
304 heap = get_heap(dev_priv, initheap.region); 304 heap = get_heap(dev_priv, initheap.region);
305 if (!heap) 305 if (!heap)
306 return DRM_ERR(EFAULT); 306 return -EFAULT;
307 307
308 if (*heap) { 308 if (*heap) {
309 DRM_ERROR("heap already initialized?"); 309 DRM_ERROR("heap already initialized?");
310 return DRM_ERR(EFAULT); 310 return -EFAULT;
311 } 311 }
312 312
313 return init_heap(heap, initheap.start, initheap.size); 313 return init_heap(heap, initheap.start, initheap.size);