Commit 20caafa6 authored by Eric Anholt's avatar Eric Anholt Committed by Dave Airlie

drm: Remove DRM_ERR OS macro.

This was used to make all ioctl handlers return -errno on linux and errno on
*BSD.  Instead, just return -errno in shared code, and flip sign on return f
shared code to *BSD code.
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 23fd5045
...@@ -130,7 +130,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) ...@@ -130,7 +130,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS)
if (update.num && !rects) { if (update.num && !rects) {
DRM_ERROR("Failed to allocate cliprect memory\n"); DRM_ERROR("Failed to allocate cliprect memory\n");
err = DRM_ERR(ENOMEM); err = -ENOMEM;
goto error; goto error;
} }
...@@ -140,7 +140,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) ...@@ -140,7 +140,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS)
update.num * update.num *
sizeof(*rects))) { sizeof(*rects))) {
DRM_ERROR("Failed to copy cliprects from userspace\n"); DRM_ERROR("Failed to copy cliprects from userspace\n");
err = DRM_ERR(EFAULT); err = -EFAULT;
goto error; goto error;
} }
...@@ -161,7 +161,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) ...@@ -161,7 +161,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS)
break; break;
default: default:
DRM_ERROR("Invalid update type %d\n", update.type); DRM_ERROR("Invalid update type %d\n", update.type);
return DRM_ERR(EINVAL); return -EINVAL;
} }
return 0; return 0;
......
...@@ -123,7 +123,7 @@ int drm_setunique(struct inode *inode, struct file *filp, ...@@ -123,7 +123,7 @@ int drm_setunique(struct inode *inode, struct file *filp,
*/ */
ret = sscanf(dev->unique, "PCI:%d:%d:%d", &bus, &slot, &func); ret = sscanf(dev->unique, "PCI:%d:%d:%d", &bus, &slot, &func);
if (ret != 3) if (ret != 3)
return DRM_ERR(EINVAL); return -EINVAL;
domain = bus >> 8; domain = bus >> 8;
bus &= 0xff; bus &= 0xff;
......
...@@ -125,7 +125,7 @@ int drm_lock(struct inode *inode, struct file *filp, ...@@ -125,7 +125,7 @@ int drm_lock(struct inode *inode, struct file *filp,
if (dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT)) { if (dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT)) {
if (dev->driver->dma_quiescent(dev)) { if (dev->driver->dma_quiescent(dev)) {
DRM_DEBUG("%d waiting for DMA quiescent\n", lock.context); DRM_DEBUG("%d waiting for DMA quiescent\n", lock.context);
return DRM_ERR(EBUSY); return -EBUSY;
} }
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#define DRMFILE struct file * #define DRMFILE struct file *
/** Ioctl arguments */ /** Ioctl arguments */
#define DRM_IOCTL_ARGS struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data #define DRM_IOCTL_ARGS struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data
#define DRM_ERR(d) -(d)
/** Current process ID */ /** Current process ID */
#define DRM_CURRENTPID current->pid #define DRM_CURRENTPID current->pid
#define DRM_SUSER(p) capable(CAP_SYS_ADMIN) #define DRM_SUSER(p) capable(CAP_SYS_ADMIN)
......
...@@ -380,7 +380,7 @@ static int i810_dma_initialize(struct drm_device * dev, ...@@ -380,7 +380,7 @@ static int i810_dma_initialize(struct drm_device * dev,
i810_dma_cleanup(dev); i810_dma_cleanup(dev);
DRM_ERROR("can not ioremap virtual address for" DRM_ERROR("can not ioremap virtual address for"
" ring buffer\n"); " ring buffer\n");
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
dev_priv->ring.virtual_start = dev_priv->ring.map.handle; dev_priv->ring.virtual_start = dev_priv->ring.map.handle;
......
...@@ -389,7 +389,7 @@ static int i830_dma_initialize(struct drm_device * dev, ...@@ -389,7 +389,7 @@ static int i830_dma_initialize(struct drm_device * dev,
i830_dma_cleanup(dev); i830_dma_cleanup(dev);
DRM_ERROR("can not ioremap virtual address for" DRM_ERROR("can not ioremap virtual address for"
" ring buffer\n"); " ring buffer\n");
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
dev_priv->ring.virtual_start = dev_priv->ring.map.handle; dev_priv->ring.virtual_start = dev_priv->ring.map.handle;
......
...@@ -70,7 +70,7 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller) ...@@ -70,7 +70,7 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller)
last_head = ring->head; last_head = ring->head;
} }
return DRM_ERR(EBUSY); return -EBUSY;
} }
void i915_kernel_lost_context(struct drm_device * dev) void i915_kernel_lost_context(struct drm_device * dev)
...@@ -137,7 +137,7 @@ static int i915_initialize(struct drm_device * dev, ...@@ -137,7 +137,7 @@ static int i915_initialize(struct drm_device * dev,
DRM_ERROR("can not find sarea!\n"); DRM_ERROR("can not find sarea!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
i915_dma_cleanup(dev); i915_dma_cleanup(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->mmio_map = drm_core_findmap(dev, init->mmio_offset); dev_priv->mmio_map = drm_core_findmap(dev, init->mmio_offset);
...@@ -145,7 +145,7 @@ static int i915_initialize(struct drm_device * dev, ...@@ -145,7 +145,7 @@ static int i915_initialize(struct drm_device * dev,
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
i915_dma_cleanup(dev); i915_dma_cleanup(dev);
DRM_ERROR("can not find mmio map!\n"); DRM_ERROR("can not find mmio map!\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->sarea_priv = (drm_i915_sarea_t *) dev_priv->sarea_priv = (drm_i915_sarea_t *)
...@@ -169,7 +169,7 @@ static int i915_initialize(struct drm_device * dev, ...@@ -169,7 +169,7 @@ static int i915_initialize(struct drm_device * dev,
i915_dma_cleanup(dev); i915_dma_cleanup(dev);
DRM_ERROR("can not ioremap virtual address for" DRM_ERROR("can not ioremap virtual address for"
" ring buffer\n"); " ring buffer\n");
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
dev_priv->ring.virtual_start = dev_priv->ring.map.handle; dev_priv->ring.virtual_start = dev_priv->ring.map.handle;
...@@ -200,7 +200,7 @@ static int i915_initialize(struct drm_device * dev, ...@@ -200,7 +200,7 @@ static int i915_initialize(struct drm_device * dev,
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
i915_dma_cleanup(dev); i915_dma_cleanup(dev);
DRM_ERROR("Can not allocate hardware status page\n"); DRM_ERROR("Can not allocate hardware status page\n");
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr; dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr;
dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr; dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr;
...@@ -221,24 +221,24 @@ static int i915_dma_resume(struct drm_device * dev) ...@@ -221,24 +221,24 @@ static int i915_dma_resume(struct drm_device * dev)
if (!dev_priv->sarea) { if (!dev_priv->sarea) {
DRM_ERROR("can not find sarea!\n"); DRM_ERROR("can not find sarea!\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (!dev_priv->mmio_map) { if (!dev_priv->mmio_map) {
DRM_ERROR("can not find mmio map!\n"); DRM_ERROR("can not find mmio map!\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (dev_priv->ring.map.handle == NULL) { if (dev_priv->ring.map.handle == NULL) {
DRM_ERROR("can not ioremap virtual address for" DRM_ERROR("can not ioremap virtual address for"
" ring buffer\n"); " ring buffer\n");
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
/* Program Hardware Status Page */ /* Program Hardware Status Page */
if (!dev_priv->hw_status_page) { if (!dev_priv->hw_status_page) {
DRM_ERROR("Can not find hardware status page\n"); DRM_ERROR("Can not find hardware status page\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page); DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page);
...@@ -266,7 +266,7 @@ static int i915_dma_init(DRM_IOCTL_ARGS) ...@@ -266,7 +266,7 @@ static int i915_dma_init(DRM_IOCTL_ARGS)
dev_priv = drm_alloc(sizeof(drm_i915_private_t), dev_priv = drm_alloc(sizeof(drm_i915_private_t),
DRM_MEM_DRIVER); DRM_MEM_DRIVER);
if (dev_priv == NULL) if (dev_priv == NULL)
return DRM_ERR(ENOMEM); return -ENOMEM;
retcode = i915_initialize(dev, dev_priv, &init); retcode = i915_initialize(dev, dev_priv, &init);
break; break;
case I915_CLEANUP_DMA: case I915_CLEANUP_DMA:
...@@ -276,7 +276,7 @@ static int i915_dma_init(DRM_IOCTL_ARGS) ...@@ -276,7 +276,7 @@ static int i915_dma_init(DRM_IOCTL_ARGS)
retcode = i915_dma_resume(dev); retcode = i915_dma_resume(dev);
break; break;
default: default:
retcode = DRM_ERR(EINVAL); retcode = -EINVAL;
break; break;
} }
...@@ -366,7 +366,7 @@ static int i915_emit_cmds(struct drm_device * dev, int __user * buffer, int dwor ...@@ -366,7 +366,7 @@ static int i915_emit_cmds(struct drm_device * dev, int __user * buffer, int dwor
RING_LOCALS; RING_LOCALS;
if ((dwords+1) * sizeof(int) >= dev_priv->ring.Size - 8) if ((dwords+1) * sizeof(int) >= dev_priv->ring.Size - 8)
return DRM_ERR(EINVAL); return -EINVAL;
BEGIN_LP_RING((dwords+1)&~1); BEGIN_LP_RING((dwords+1)&~1);
...@@ -374,17 +374,17 @@ static int i915_emit_cmds(struct drm_device * dev, int __user * buffer, int dwor ...@@ -374,17 +374,17 @@ static int i915_emit_cmds(struct drm_device * dev, int __user * buffer, int dwor
int cmd, sz; int cmd, sz;
if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd)))
return DRM_ERR(EINVAL); return -EINVAL;
if ((sz = validate_cmd(cmd)) == 0 || i + sz > dwords) if ((sz = validate_cmd(cmd)) == 0 || i + sz > dwords)
return DRM_ERR(EINVAL); return -EINVAL;
OUT_RING(cmd); OUT_RING(cmd);
while (++i, --sz) { while (++i, --sz) {
if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i],
sizeof(cmd))) { sizeof(cmd))) {
return DRM_ERR(EINVAL); return -EINVAL;
} }
OUT_RING(cmd); OUT_RING(cmd);
} }
...@@ -407,13 +407,13 @@ static int i915_emit_box(struct drm_device * dev, ...@@ -407,13 +407,13 @@ static int i915_emit_box(struct drm_device * dev,
RING_LOCALS; RING_LOCALS;
if (DRM_COPY_FROM_USER_UNCHECKED(&box, &boxes[i], sizeof(box))) { if (DRM_COPY_FROM_USER_UNCHECKED(&box, &boxes[i], sizeof(box))) {
return DRM_ERR(EFAULT); return -EFAULT;
} }
if (box.y2 <= box.y1 || box.x2 <= box.x1 || box.y2 <= 0 || box.x2 <= 0) { if (box.y2 <= box.y1 || box.x2 <= box.x1 || box.y2 <= 0 || box.x2 <= 0) {
DRM_ERROR("Bad box %d,%d..%d,%d\n", DRM_ERROR("Bad box %d,%d..%d,%d\n",
box.x1, box.y1, box.x2, box.y2); box.x1, box.y1, box.x2, box.y2);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (IS_I965G(dev)) { if (IS_I965G(dev)) {
...@@ -467,7 +467,7 @@ static int i915_dispatch_cmdbuffer(struct drm_device * dev, ...@@ -467,7 +467,7 @@ static int i915_dispatch_cmdbuffer(struct drm_device * dev,
if (cmd->sz & 0x3) { if (cmd->sz & 0x3) {
DRM_ERROR("alignment"); DRM_ERROR("alignment");
return DRM_ERR(EINVAL); return -EINVAL;
} }
i915_kernel_lost_context(dev); i915_kernel_lost_context(dev);
...@@ -502,7 +502,7 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev, ...@@ -502,7 +502,7 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev,
if ((batch->start | batch->used) & 0x7) { if ((batch->start | batch->used) & 0x7) {
DRM_ERROR("alignment"); DRM_ERROR("alignment");
return DRM_ERR(EINVAL); return -EINVAL;
} }
i915_kernel_lost_context(dev); i915_kernel_lost_context(dev);
...@@ -619,7 +619,7 @@ static int i915_batchbuffer(DRM_IOCTL_ARGS) ...@@ -619,7 +619,7 @@ static int i915_batchbuffer(DRM_IOCTL_ARGS)
if (!dev_priv->allow_batchbuffer) { if (!dev_priv->allow_batchbuffer) {
DRM_ERROR("Batchbuffer ioctl disabled\n"); DRM_ERROR("Batchbuffer ioctl disabled\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(batch, (drm_i915_batchbuffer_t __user *) data, DRM_COPY_FROM_USER_IOCTL(batch, (drm_i915_batchbuffer_t __user *) data,
...@@ -633,7 +633,7 @@ static int i915_batchbuffer(DRM_IOCTL_ARGS) ...@@ -633,7 +633,7 @@ static int i915_batchbuffer(DRM_IOCTL_ARGS)
if (batch.num_cliprects && DRM_VERIFYAREA_READ(batch.cliprects, if (batch.num_cliprects && DRM_VERIFYAREA_READ(batch.cliprects,
batch.num_cliprects * batch.num_cliprects *
sizeof(struct drm_clip_rect))) sizeof(struct drm_clip_rect)))
return DRM_ERR(EFAULT); return -EFAULT;
ret = i915_dispatch_batchbuffer(dev, &batch); ret = i915_dispatch_batchbuffer(dev, &batch);
...@@ -664,7 +664,7 @@ static int i915_cmdbuffer(DRM_IOCTL_ARGS) ...@@ -664,7 +664,7 @@ static int i915_cmdbuffer(DRM_IOCTL_ARGS)
cmdbuf.num_cliprects * cmdbuf.num_cliprects *
sizeof(struct drm_clip_rect))) { sizeof(struct drm_clip_rect))) {
DRM_ERROR("Fault accessing cliprects\n"); DRM_ERROR("Fault accessing cliprects\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
ret = i915_dispatch_cmdbuffer(dev, &cmdbuf); ret = i915_dispatch_cmdbuffer(dev, &cmdbuf);
...@@ -697,7 +697,7 @@ static int i915_getparam(DRM_IOCTL_ARGS) ...@@ -697,7 +697,7 @@ static int i915_getparam(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(param, (drm_i915_getparam_t __user *) data, DRM_COPY_FROM_USER_IOCTL(param, (drm_i915_getparam_t __user *) data,
...@@ -715,12 +715,12 @@ static int i915_getparam(DRM_IOCTL_ARGS) ...@@ -715,12 +715,12 @@ static int i915_getparam(DRM_IOCTL_ARGS)
break; break;
default: default:
DRM_ERROR("Unknown parameter %d\n", param.param); DRM_ERROR("Unknown parameter %d\n", param.param);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) { if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) {
DRM_ERROR("DRM_COPY_TO_USER failed\n"); DRM_ERROR("DRM_COPY_TO_USER failed\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
return 0; return 0;
...@@ -734,7 +734,7 @@ static int i915_setparam(DRM_IOCTL_ARGS) ...@@ -734,7 +734,7 @@ static int i915_setparam(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(param, (drm_i915_setparam_t __user *) data, DRM_COPY_FROM_USER_IOCTL(param, (drm_i915_setparam_t __user *) data,
...@@ -753,7 +753,7 @@ static int i915_setparam(DRM_IOCTL_ARGS) ...@@ -753,7 +753,7 @@ static int i915_setparam(DRM_IOCTL_ARGS)
break; break;
default: default:
DRM_ERROR("unknown parameter %d\n", param.param); DRM_ERROR("unknown parameter %d\n", param.param);
return DRM_ERR(EINVAL); return -EINVAL;
} }
return 0; return 0;
...@@ -767,7 +767,7 @@ static int i915_set_status_page(DRM_IOCTL_ARGS) ...@@ -767,7 +767,7 @@ static int i915_set_status_page(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(hws, (drm_i915_hws_addr_t __user *) data, DRM_COPY_FROM_USER_IOCTL(hws, (drm_i915_hws_addr_t __user *) data,
sizeof(hws)); sizeof(hws));
...@@ -788,7 +788,7 @@ static int i915_set_status_page(DRM_IOCTL_ARGS) ...@@ -788,7 +788,7 @@ static int i915_set_status_page(DRM_IOCTL_ARGS)
dev_priv->status_gfx_addr = 0; dev_priv->status_gfx_addr = 0;
DRM_ERROR("can not ioremap virtual address for" DRM_ERROR("can not ioremap virtual address for"
" G33 hw status page\n"); " G33 hw status page\n");
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
dev_priv->hw_status_page = dev_priv->hws_map.handle; dev_priv->hw_status_page = dev_priv->hws_map.handle;
......
...@@ -311,7 +311,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr) ...@@ -311,7 +311,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
DRM_WAIT_ON(ret, dev_priv->irq_queue, 3 * DRM_HZ, DRM_WAIT_ON(ret, dev_priv->irq_queue, 3 * DRM_HZ,
READ_BREADCRUMB(dev_priv) >= irq_nr); READ_BREADCRUMB(dev_priv) >= irq_nr);
if (ret == DRM_ERR(EBUSY)) { if (ret == -EBUSY) {
DRM_ERROR("%s: EBUSY -- rec: %d emitted: %d\n", DRM_ERROR("%s: EBUSY -- rec: %d emitted: %d\n",
__FUNCTION__, __FUNCTION__,
READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); READ_BREADCRUMB(dev_priv), (int)dev_priv->counter);
...@@ -330,7 +330,7 @@ static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequ ...@@ -330,7 +330,7 @@ static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequ
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
...@@ -366,7 +366,7 @@ int i915_irq_emit(DRM_IOCTL_ARGS) ...@@ -366,7 +366,7 @@ int i915_irq_emit(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(emit, (drm_i915_irq_emit_t __user *) data, DRM_COPY_FROM_USER_IOCTL(emit, (drm_i915_irq_emit_t __user *) data,
...@@ -376,7 +376,7 @@ int i915_irq_emit(DRM_IOCTL_ARGS) ...@@ -376,7 +376,7 @@ int i915_irq_emit(DRM_IOCTL_ARGS)
if (DRM_COPY_TO_USER(emit.irq_seq, &result, sizeof(int))) { if (DRM_COPY_TO_USER(emit.irq_seq, &result, sizeof(int))) {
DRM_ERROR("copy_to_user\n"); DRM_ERROR("copy_to_user\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
return 0; return 0;
...@@ -392,7 +392,7 @@ int i915_irq_wait(DRM_IOCTL_ARGS) ...@@ -392,7 +392,7 @@ int i915_irq_wait(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(irqwait, (drm_i915_irq_wait_t __user *) data, DRM_COPY_FROM_USER_IOCTL(irqwait, (drm_i915_irq_wait_t __user *) data,
...@@ -425,7 +425,7 @@ int i915_vblank_pipe_set(DRM_IOCTL_ARGS) ...@@ -425,7 +425,7 @@ int i915_vblank_pipe_set(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(pipe, (drm_i915_vblank_pipe_t __user *) data, DRM_COPY_FROM_USER_IOCTL(pipe, (drm_i915_vblank_pipe_t __user *) data,
...@@ -434,7 +434,7 @@ int i915_vblank_pipe_set(DRM_IOCTL_ARGS) ...@@ -434,7 +434,7 @@ int i915_vblank_pipe_set(DRM_IOCTL_ARGS)
if (pipe.pipe & ~(DRM_I915_VBLANK_PIPE_A|DRM_I915_VBLANK_PIPE_B)) { if (pipe.pipe & ~(DRM_I915_VBLANK_PIPE_A|DRM_I915_VBLANK_PIPE_B)) {
DRM_ERROR("%s called with invalid pipe 0x%x\n", DRM_ERROR("%s called with invalid pipe 0x%x\n",
__FUNCTION__, pipe.pipe); __FUNCTION__, pipe.pipe);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->vblank_pipe = pipe.pipe; dev_priv->vblank_pipe = pipe.pipe;
...@@ -453,7 +453,7 @@ int i915_vblank_pipe_get(DRM_IOCTL_ARGS) ...@@ -453,7 +453,7 @@ int i915_vblank_pipe_get(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
flag = I915_READ(I915REG_INT_ENABLE_R); flag = I915_READ(I915REG_INT_ENABLE_R);
...@@ -482,12 +482,12 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) ...@@ -482,12 +482,12 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __func__); DRM_ERROR("%s called with no initialization\n", __func__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (dev_priv->sarea_priv->rotation) { if (dev_priv->sarea_priv->rotation) {
DRM_DEBUG("Rotation not supported\n"); DRM_DEBUG("Rotation not supported\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(swap, (drm_i915_vblank_swap_t __user *) data, DRM_COPY_FROM_USER_IOCTL(swap, (drm_i915_vblank_swap_t __user *) data,
...@@ -496,7 +496,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) ...@@ -496,7 +496,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
if (swap.seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE | if (swap.seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE |
_DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)) { _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)) {
DRM_ERROR("Invalid sequence type 0x%x\n", swap.seqtype); DRM_ERROR("Invalid sequence type 0x%x\n", swap.seqtype);
return DRM_ERR(EINVAL); return -EINVAL;
} }
pipe = (swap.seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; pipe = (swap.seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0;
...@@ -505,7 +505,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) ...@@ -505,7 +505,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
if (!(dev_priv->vblank_pipe & (1 << pipe))) { if (!(dev_priv->vblank_pipe & (1 << pipe))) {
DRM_ERROR("Invalid pipe %d\n", pipe); DRM_ERROR("Invalid pipe %d\n", pipe);
return DRM_ERR(EINVAL); return -EINVAL;
} }
spin_lock_irqsave(&dev->drw_lock, irqflags); spin_lock_irqsave(&dev->drw_lock, irqflags);
...@@ -513,7 +513,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) ...@@ -513,7 +513,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
if (!drm_get_drawable_info(dev, swap.drawable)) { if (!drm_get_drawable_info(dev, swap.drawable)) {
spin_unlock_irqrestore(&dev->drw_lock, irqflags); spin_unlock_irqrestore(&dev->drw_lock, irqflags);
DRM_DEBUG("Invalid drawable ID %d\n", swap.drawable); DRM_DEBUG("Invalid drawable ID %d\n", swap.drawable);
return DRM_ERR(EINVAL); return -EINVAL;
} }
spin_unlock_irqrestore(&dev->drw_lock, irqflags); spin_unlock_irqrestore(&dev->drw_lock, irqflags);
...@@ -528,7 +528,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) ...@@ -528,7 +528,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
swap.sequence = curseq + 1; swap.sequence = curseq + 1;
} else { } else {
DRM_DEBUG("Missed target sequence\n"); DRM_DEBUG("Missed target sequence\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
...@@ -550,14 +550,14 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) ...@@ -550,14 +550,14 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
if (dev_priv->swaps_pending >= 100) { if (dev_priv->swaps_pending >= 100) {
DRM_DEBUG("Too many swaps queued\n"); DRM_DEBUG("Too many swaps queued\n");
return DRM_ERR(EBUSY); return -EBUSY;
} }
vbl_swap = drm_calloc(1, sizeof(vbl_swap), DRM_MEM_DRIVER); vbl_swap = drm_calloc(1, sizeof(vbl_swap), DRM_MEM_DRIVER);
if (!vbl_swap) { if (!vbl_swap) {
DRM_ERROR("Failed to allocate memory to queue swap\n"); DRM_ERROR("Failed to allocate memory to queue swap\n");
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
DRM_DEBUG("\n"); DRM_DEBUG("\n");
......
...@@ -276,7 +276,7 @@ int i915_mem_alloc(DRM_IOCTL_ARGS) ...@@ -276,7 +276,7 @@ int i915_mem_alloc(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(alloc, (drm_i915_mem_alloc_t __user *) data, DRM_COPY_FROM_USER_IOCTL(alloc, (drm_i915_mem_alloc_t __user *) data,
...@@ -284,7 +284,7 @@ int i915_mem_alloc(DRM_IOCTL_ARGS) ...@@ -284,7 +284,7 @@ int i915_mem_alloc(DRM_IOCTL_ARGS)
heap = get_heap(dev_priv, alloc.region); heap = get_heap(dev_priv, alloc.region);
if (!heap || !*heap) if (!heap || !*heap)
return DRM_ERR(EFAULT); return -EFAULT;
/* Make things easier on ourselves: all allocations at least /* Make things easier on ourselves: all allocations at least
* 4k aligned. * 4k aligned.
...@@ -295,13 +295,13 @@ int i915_mem_alloc(DRM_IOCTL_ARGS) ...@@ -295,13 +295,13 @@ int i915_mem_alloc(DRM_IOCTL_ARGS)
block = alloc_block(*heap, alloc.size, alloc.alignment, filp); block = alloc_block(*heap, alloc.size, alloc.alignment, filp);
if (!block) if (!block)
return DRM_ERR(ENOMEM); return -ENOMEM;
mark_block(dev, block, 1); mark_block(dev, block, 1);
if (DRM_COPY_TO_USER(alloc.region_offset, &block->start, sizeof(int))) { if (DRM_COPY_TO_USER(alloc.region_offset, &block->start, sizeof(int))) {
DRM_ERROR("copy_to_user\n"); DRM_ERROR("copy_to_user\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
return 0; return 0;
...@@ -316,7 +316,7 @@ int i915_mem_free(DRM_IOCTL_ARGS) ...@@ -316,7 +316,7 @@ int i915_mem_free(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(memfree, (drm_i915_mem_free_t __user *) data, DRM_COPY_FROM_USER_IOCTL(memfree, (drm_i915_mem_free_t __user *) data,
...@@ -324,14 +324,14 @@ int i915_mem_free(DRM_IOCTL_ARGS) ...@@ -324,14 +324,14 @@ int i915_mem_free(DRM_IOCTL_ARGS)
heap = get_heap(dev_priv, memfree.region); heap = get_heap(dev_priv, memfree.region);
if (!heap || !*heap) if (!heap || !*heap)
return DRM_ERR(EFAULT); return -EFAULT;
block = find_block(*heap, memfree.region_offset); block = find_block(*heap, memfree.region_offset);
if (!block) if (!block)
return DRM_ERR(EFAULT); return -EFAULT;
if (block->filp != filp) if (block->filp != filp)
return DRM_ERR(EPERM); return -EPERM;
mark_block(dev, block, 0); mark_block(dev, block, 0);
free_block(block); free_block(block);
...@@ -347,7 +347,7 @@ int i915_mem_init_heap(DRM_IOCTL_ARGS) ...@@ -347,7 +347,7 @@ int i915_mem_init_heap(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(initheap, DRM_COPY_FROM_USER_IOCTL(initheap,
...@@ -356,11 +356,11 @@ int i915_mem_init_heap(DRM_IOCTL_ARGS) ...@@ -356,11 +356,11 @@ int i915_mem_init_heap(DRM_IOCTL_ARGS)
heap = get_heap(dev_priv, initheap.region); heap = get_heap(dev_priv, initheap.region);
if (!heap) if (!heap)
return DRM_ERR(EFAULT); return -EFAULT;
if (*heap) { if (*heap) {
DRM_ERROR("heap already initialized?"); DRM_ERROR("heap already initialized?");
return DRM_ERR(EFAULT); return -EFAULT;
} }
return init_heap(heap, initheap.start, initheap.size); return init_heap(heap, initheap.start, initheap.size);
...@@ -375,7 +375,7 @@ int i915_mem_destroy_heap( DRM_IOCTL_ARGS ) ...@@ -375,7 +375,7 @@ int i915_mem_destroy_heap( DRM_IOCTL_ARGS )
if ( !dev_priv ) { if ( !dev_priv ) {
DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ );
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL( destroyheap, (drm_i915_mem_destroy_heap_t *)data, DRM_COPY_FROM_USER_IOCTL( destroyheap, (drm_i915_mem_destroy_heap_t *)data,
...@@ -384,12 +384,12 @@ int i915_mem_destroy_heap( DRM_IOCTL_ARGS ) ...@@ -384,12 +384,12 @@ int i915_mem_destroy_heap( DRM_IOCTL_ARGS )
heap = get_heap( dev_priv, destroyheap.region ); heap = get_heap( dev_priv, destroyheap.region );
if (!heap) { if (!heap) {
DRM_ERROR("get_heap failed"); DRM_ERROR("get_heap failed");
return DRM_ERR(EFAULT); return -EFAULT;
} }
if (!*heap) { if (!*heap) {
DRM_ERROR("heap not initialized?"); DRM_ERROR("heap not initialized?");
return DRM_ERR(EFAULT); return -EFAULT;
} }
i915_mem_takedown( heap ); i915_mem_takedown( heap );
......
...@@ -71,7 +71,7 @@ int mga_do_wait_for_idle(drm_mga_private_t * dev_priv) ...@@ -71,7 +71,7 @@ int mga_do_wait_for_idle(drm_mga_private_t * dev_priv)
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
DRM_INFO(" status=0x%08x\n", status); DRM_INFO(" status=0x%08x\n", status);
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
static int mga_do_dma_reset(drm_mga_private_t * dev_priv) static int mga_do_dma_reset(drm_mga_private_t * dev_priv)
...@@ -256,7 +256,7 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr ...@@ -256,7 +256,7 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr
dev_priv->head = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); dev_priv->head = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER);
if (dev_priv->head == NULL) if (dev_priv->head == NULL)
return DRM_ERR(ENOMEM); return -ENOMEM;
memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t)); memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t));
SET_AGE(&dev_priv->head->age, MGA_BUFFER_USED, 0); SET_AGE(&dev_priv->head->age, MGA_BUFFER_USED, 0);
...@@ -267,7 +267,7 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr ...@@ -267,7 +267,7 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr
entry = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); entry = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER);
if (entry == NULL) if (entry == NULL)
return DRM_ERR(ENOMEM); return -ENOMEM;
memset(entry, 0, sizeof(drm_mga_freelist_t)); memset(entry, 0, sizeof(drm_mga_freelist_t));
...@@ -399,7 +399,7 @@ int mga_driver_load(struct drm_device * dev, unsigned long flags) ...@@ -399,7 +399,7 @@ int mga_driver_load(struct drm_device * dev, unsigned long flags)
dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER); dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER);
if (!dev_priv) if (!dev_priv)
return DRM_ERR(ENOMEM); return -ENOMEM;
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
memset(dev_priv, 0, sizeof(drm_mga_private_t)); memset(dev_priv, 0, sizeof(drm_mga_private_t));
...@@ -578,7 +578,7 @@ static int mga_do_agp_dma_bootstrap(struct drm_device * dev, ...@@ -578,7 +578,7 @@ static int mga_do_agp_dma_bootstrap(struct drm_device * dev,
DRM_ERROR("failed to ioremap agp regions! (%p, %p, %p)\n", DRM_ERROR("failed to ioremap agp regions! (%p, %p, %p)\n",
dev_priv->warp->handle, dev_priv->primary->handle, dev_priv->warp->handle, dev_priv->primary->handle,
dev->agp_buffer_map->handle); dev->agp_buffer_map->handle);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
dev_priv->dma_access = MGA_PAGPXFER; dev_priv->dma_access = MGA_PAGPXFER;
...@@ -622,7 +622,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device * dev, ...@@ -622,7 +622,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device * dev,
if (dev->dma == NULL) { if (dev->dma == NULL) {
DRM_ERROR("dev->dma is NULL\n"); DRM_ERROR("dev->dma is NULL\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
/* Make drm_addbufs happy by not trying to create a mapping for less /* Make drm_addbufs happy by not trying to create a mapping for less
...@@ -656,7 +656,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device * dev, ...@@ -656,7 +656,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device * dev,
if (err != 0) { if (err != 0) {
DRM_ERROR("Unable to allocate primary DMA region: %d\n", err); DRM_ERROR("Unable to allocate primary DMA region: %d\n", err);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
if (dev_priv->primary->size != dma_bs->primary_size) { if (dev_priv->primary->size != dma_bs->primary_size) {
...@@ -826,7 +826,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) ...@@ -826,7 +826,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init)
dev_priv->sarea = drm_getsarea(dev); dev_priv->sarea = drm_getsarea(dev);
if (!dev_priv->sarea) { if (!dev_priv->sarea) {
DRM_ERROR("failed to find sarea!\n"); DRM_ERROR("failed to find sarea!\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (!dev_priv->used_new_dma_init) { if (!dev_priv->used_new_dma_init) {
...@@ -837,29 +837,29 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) ...@@ -837,29 +837,29 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init)
dev_priv->status = drm_core_findmap(dev, init->status_offset); dev_priv->status = drm_core_findmap(dev, init->status_offset);
if (!dev_priv->status) { if (!dev_priv->status) {
DRM_ERROR("failed to find status page!\n"); DRM_ERROR("failed to find status page!\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset);
if (!dev_priv->mmio) { if (!dev_priv->mmio) {
DRM_ERROR("failed to find mmio region!\n"); DRM_ERROR("failed to find mmio region!\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->warp = drm_core_findmap(dev, init->warp_offset); dev_priv->warp = drm_core_findmap(dev, init->warp_offset);
if (!dev_priv->warp) { if (!dev_priv->warp) {
DRM_ERROR("failed to find warp microcode region!\n"); DRM_ERROR("failed to find warp microcode region!\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->primary = drm_core_findmap(dev, init->primary_offset); dev_priv->primary = drm_core_findmap(dev, init->primary_offset);
if (!dev_priv->primary) { if (!dev_priv->primary) {
DRM_ERROR("failed to find primary dma region!\n"); DRM_ERROR("failed to find primary dma region!\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_token = init->buffers_offset;
dev->agp_buffer_map = dev->agp_buffer_map =
drm_core_findmap(dev, init->buffers_offset); drm_core_findmap(dev, init->buffers_offset);
if (!dev->agp_buffer_map) { if (!dev->agp_buffer_map) {
DRM_ERROR("failed to find dma buffer region!\n"); DRM_ERROR("failed to find dma buffer region!\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
drm_core_ioremap(dev_priv->warp, dev); drm_core_ioremap(dev_priv->warp, dev);
...@@ -877,7 +877,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) ...@@ -877,7 +877,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init)
((dev->agp_buffer_map == NULL) || ((dev->agp_buffer_map == NULL) ||
(dev->agp_buffer_map->handle == NULL)))) { (dev->agp_buffer_map->handle == NULL)))) {
DRM_ERROR("failed to ioremap agp regions!\n"); DRM_ERROR("failed to ioremap agp regions!\n");
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
ret = mga_warp_install_microcode(dev_priv); ret = mga_warp_install_microcode(dev_priv);
...@@ -927,7 +927,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) ...@@ -927,7 +927,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init)
if (mga_freelist_init(dev, dev_priv) < 0) { if (mga_freelist_init(dev, dev_priv) < 0) {
DRM_ERROR("could not initialize freelist\n"); DRM_ERROR("could not initialize freelist\n");
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
return 0; return 0;
...@@ -1029,7 +1029,7 @@ int mga_dma_init(DRM_IOCTL_ARGS) ...@@ -1029,7 +1029,7 @@ int mga_dma_init(DRM_IOCTL_ARGS)
return mga_do_cleanup_dma(dev, FULL_CLEANUP); return mga_do_cleanup_dma(dev, FULL_CLEANUP);
} }
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* ================================================================ /* ================================================================
...@@ -1094,16 +1094,16 @@ static int mga_dma_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm ...@@ -1094,16 +1094,16 @@ static int mga_dma_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm
for (i = d->granted_count; i < d->request_count; i++) { for (i = d->granted_count; i < d->request_count; i++) {
buf = mga_freelist_get(dev); buf = mga_freelist_get(dev);
if (!buf) if (!buf)
return DRM_ERR(EAGAIN); return -EAGAIN;
buf->filp = filp; buf->filp = filp;
if (DRM_COPY_TO_USER(&d->request_indices[i], if (DRM_COPY_TO_USER(&d->request_indices[i],
&buf->idx, sizeof(buf->idx))) &buf->idx, sizeof(buf->idx)))
return DRM_ERR(EFAULT); return -EFAULT;
if (DRM_COPY_TO_USER(&d->request_sizes[i], if (DRM_COPY_TO_USER(&d->request_sizes[i],
&buf->total, sizeof(buf->total))) &buf->total, sizeof(buf->total)))
return DRM_ERR(EFAULT); return -EFAULT;
d->granted_count++; d->granted_count++;
} }
...@@ -1128,7 +1128,7 @@ int mga_dma_buffers(DRM_IOCTL_ARGS) ...@@ -1128,7 +1128,7 @@ int mga_dma_buffers(DRM_IOCTL_ARGS)
if (d.send_count != 0) { if (d.send_count != 0) {
DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
DRM_CURRENTPID, d.send_count); DRM_CURRENTPID, d.send_count);
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* We'll send you buffers. /* We'll send you buffers.
...@@ -1136,7 +1136,7 @@ int mga_dma_buffers(DRM_IOCTL_ARGS) ...@@ -1136,7 +1136,7 @@ int mga_dma_buffers(DRM_IOCTL_ARGS)
if (d.request_count < 0 || d.request_count > dma->buf_count) { if (d.request_count < 0 || d.request_count > dma->buf_count) {
DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
DRM_CURRENTPID, d.request_count, dma->buf_count); DRM_CURRENTPID, d.request_count, dma->buf_count);
return DRM_ERR(EINVAL); return -EINVAL;
} }
WRAP_TEST_WITH_RETURN(dev_priv); WRAP_TEST_WITH_RETURN(dev_priv);
......
...@@ -245,7 +245,7 @@ do { \ ...@@ -245,7 +245,7 @@ do { \
dev_priv->prim.high_mark ) { \ dev_priv->prim.high_mark ) { \
if ( MGA_DMA_DEBUG ) \ if ( MGA_DMA_DEBUG ) \
DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \ DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \
return DRM_ERR(EBUSY); \ return -EBUSY; \
} \ } \
} \ } \
} while (0) } while (0)
...@@ -256,7 +256,7 @@ do { \ ...@@ -256,7 +256,7 @@ do { \
if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { \ if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { \
if ( MGA_DMA_DEBUG ) \ if ( MGA_DMA_DEBUG ) \
DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \ DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \
return DRM_ERR(EBUSY); \ return -EBUSY; \
} \ } \
mga_do_dma_wrap_end( dev_priv ); \ mga_do_dma_wrap_end( dev_priv ); \
} \ } \
......
...@@ -392,7 +392,7 @@ static int mga_verify_context(drm_mga_private_t * dev_priv) ...@@ -392,7 +392,7 @@ static int mga_verify_context(drm_mga_private_t * dev_priv)
ctx->dstorg, dev_priv->front_offset, ctx->dstorg, dev_priv->front_offset,
dev_priv->back_offset); dev_priv->back_offset);
ctx->dstorg = 0; ctx->dstorg = 0;
return DRM_ERR(EINVAL); return -EINVAL;
} }
return 0; return 0;
...@@ -411,7 +411,7 @@ static int mga_verify_tex(drm_mga_private_t * dev_priv, int unit) ...@@ -411,7 +411,7 @@ static int mga_verify_tex(drm_mga_private_t * dev_priv, int unit)
if (org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI)) { if (org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI)) {
DRM_ERROR("*** bad TEXORG: 0x%x, unit %d\n", tex->texorg, unit); DRM_ERROR("*** bad TEXORG: 0x%x, unit %d\n", tex->texorg, unit);
tex->texorg = 0; tex->texorg = 0;
return DRM_ERR(EINVAL); return -EINVAL;
} }
return 0; return 0;
...@@ -453,13 +453,13 @@ static int mga_verify_iload(drm_mga_private_t * dev_priv, ...@@ -453,13 +453,13 @@ static int mga_verify_iload(drm_mga_private_t * dev_priv,
dstorg + length > (dev_priv->texture_offset + dstorg + length > (dev_priv->texture_offset +
dev_priv->texture_size)) { dev_priv->texture_size)) {
DRM_ERROR("*** bad iload DSTORG: 0x%x\n", dstorg); DRM_ERROR("*** bad iload DSTORG: 0x%x\n", dstorg);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (length & MGA_ILOAD_MASK) { if (length & MGA_ILOAD_MASK) {
DRM_ERROR("*** bad iload length: 0x%x\n", DRM_ERROR("*** bad iload length: 0x%x\n",
length & MGA_ILOAD_MASK); length & MGA_ILOAD_MASK);
return DRM_ERR(EINVAL); return -EINVAL;
} }
return 0; return 0;
...@@ -471,7 +471,7 @@ static int mga_verify_blit(drm_mga_private_t * dev_priv, ...@@ -471,7 +471,7 @@ static int mga_verify_blit(drm_mga_private_t * dev_priv,
if ((srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) || if ((srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ||
(dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM)) { (dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM)) {
DRM_ERROR("*** bad blit: src=0x%x dst=0x%x\n", srcorg, dstorg); DRM_ERROR("*** bad blit: src=0x%x dst=0x%x\n", srcorg, dstorg);
return DRM_ERR(EINVAL); return -EINVAL;
} }
return 0; return 0;
} }
...@@ -892,7 +892,7 @@ static int mga_dma_vertex(DRM_IOCTL_ARGS) ...@@ -892,7 +892,7 @@ static int mga_dma_vertex(DRM_IOCTL_ARGS)
sizeof(vertex)); sizeof(vertex));
if (vertex.idx < 0 || vertex.idx > dma->buf_count) if (vertex.idx < 0 || vertex.idx > dma->buf_count)
return DRM_ERR(EINVAL); return -EINVAL;
buf = dma->buflist[vertex.idx]; buf = dma->buflist[vertex.idx];
buf_priv = buf->dev_private; buf_priv = buf->dev_private;
...@@ -906,7 +906,7 @@ static int mga_dma_vertex(DRM_IOCTL_ARGS) ...@@ -906,7 +906,7 @@ static int mga_dma_vertex(DRM_IOCTL_ARGS)
buf_priv->dispatched = 0; buf_priv->dispatched = 0;
mga_freelist_put(dev, buf); mga_freelist_put(dev, buf);
} }
return DRM_ERR(EINVAL); return -EINVAL;
} }
WRAP_TEST_WITH_RETURN(dev_priv); WRAP_TEST_WITH_RETURN(dev_priv);
...@@ -932,7 +932,7 @@ static int mga_dma_indices(DRM_IOCTL_ARGS) ...@@ -932,7 +932,7 @@ static int mga_dma_indices(DRM_IOCTL_ARGS)
sizeof(indices)); sizeof(indices));
if (indices.idx < 0 || indices.idx > dma->buf_count) if (indices.idx < 0 || indices.idx > dma->buf_count)
return DRM_ERR(EINVAL); return -EINVAL;
buf = dma->buflist[indices.idx]; buf = dma->buflist[indices.idx];
buf_priv = buf->dev_private; buf_priv = buf->dev_private;
...@@ -946,7 +946,7 @@ static int mga_dma_indices(DRM_IOCTL_ARGS) ...@@ -946,7 +946,7 @@ static int mga_dma_indices(DRM_IOCTL_ARGS)
buf_priv->dispatched = 0; buf_priv->dispatched = 0;
mga_freelist_put(dev, buf); mga_freelist_put(dev, buf);
} }
return DRM_ERR(EINVAL); return -EINVAL;
} }
WRAP_TEST_WITH_RETURN(dev_priv); WRAP_TEST_WITH_RETURN(dev_priv);
...@@ -975,18 +975,18 @@ static int mga_dma_iload(DRM_IOCTL_ARGS) ...@@ -975,18 +975,18 @@ static int mga_dma_iload(DRM_IOCTL_ARGS)
if (mga_do_wait_for_idle(dev_priv) < 0) { if (mga_do_wait_for_idle(dev_priv) < 0) {
if (MGA_DMA_DEBUG) if (MGA_DMA_DEBUG)
DRM_INFO("%s: -EBUSY\n", __FUNCTION__); DRM_INFO("%s: -EBUSY\n", __FUNCTION__);
return DRM_ERR(EBUSY); return -EBUSY;
} }
#endif #endif
if (iload.idx < 0 || iload.idx > dma->buf_count) if (iload.idx < 0 || iload.idx > dma->buf_count)
return DRM_ERR(EINVAL); return -EINVAL;
buf = dma->buflist[iload.idx]; buf = dma->buflist[iload.idx];
buf_priv = buf->dev_private; buf_priv = buf->dev_private;
if (mga_verify_iload(dev_priv, iload.dstorg, iload.length)) { if (mga_verify_iload(dev_priv, iload.dstorg, iload.length)) {
mga_freelist_put(dev, buf); mga_freelist_put(dev, buf);
return DRM_ERR(EINVAL); return -EINVAL;
} }
WRAP_TEST_WITH_RETURN(dev_priv); WRAP_TEST_WITH_RETURN(dev_priv);
...@@ -1017,7 +1017,7 @@ static int mga_dma_blit(DRM_IOCTL_ARGS) ...@@ -1017,7 +1017,7 @@ static int mga_dma_blit(DRM_IOCTL_ARGS)
sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
if (mga_verify_blit(dev_priv, blit.srcorg, blit.dstorg)) if (mga_verify_blit(dev_priv, blit.srcorg, blit.dstorg))
return DRM_ERR(EINVAL); return -EINVAL;
WRAP_TEST_WITH_RETURN(dev_priv); WRAP_TEST_WITH_RETURN(dev_priv);
...@@ -1039,7 +1039,7 @@ static int mga_getparam(DRM_IOCTL_ARGS) ...@@ -1039,7 +1039,7 @@ static int mga_getparam(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(param, (drm_mga_getparam_t __user *) data, DRM_COPY_FROM_USER_IOCTL(param, (drm_mga_getparam_t __user *) data,
...@@ -1055,12 +1055,12 @@ static int mga_getparam(DRM_IOCTL_ARGS) ...@@ -1055,12 +1055,12 @@ static int mga_getparam(DRM_IOCTL_ARGS)
value = dev_priv->chipset; value = dev_priv->chipset;
break; break;
default: default:
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) { if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) {
DRM_ERROR("copy_to_user\n"); DRM_ERROR("copy_to_user\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
return 0; return 0;
...@@ -1075,7 +1075,7 @@ static int mga_set_fence(DRM_IOCTL_ARGS) ...@@ -1075,7 +1075,7 @@ static int mga_set_fence(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_DEBUG("pid=%d\n", DRM_CURRENTPID); DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
...@@ -1095,7 +1095,7 @@ static int mga_set_fence(DRM_IOCTL_ARGS) ...@@ -1095,7 +1095,7 @@ static int mga_set_fence(DRM_IOCTL_ARGS)
if (DRM_COPY_TO_USER((u32 __user *) data, &temp, sizeof(u32))) { if (DRM_COPY_TO_USER((u32 __user *) data, &temp, sizeof(u32))) {
DRM_ERROR("copy_to_user\n"); DRM_ERROR("copy_to_user\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
return 0; return 0;
...@@ -1109,7 +1109,7 @@ static int mga_wait_fence(DRM_IOCTL_ARGS) ...@@ -1109,7 +1109,7 @@ static int mga_wait_fence(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(fence, (u32 __user *) data, sizeof(u32)); DRM_COPY_FROM_USER_IOCTL(fence, (u32 __user *) data, sizeof(u32));
...@@ -1120,7 +1120,7 @@ static int mga_wait_fence(DRM_IOCTL_ARGS) ...@@ -1120,7 +1120,7 @@ static int mga_wait_fence(DRM_IOCTL_ARGS)
if (DRM_COPY_TO_USER((u32 __user *) data, &fence, sizeof(u32))) { if (DRM_COPY_TO_USER((u32 __user *) data, &fence, sizeof(u32))) {
DRM_ERROR("copy_to_user\n"); DRM_ERROR("copy_to_user\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
return 0; return 0;
......
...@@ -141,7 +141,7 @@ int mga_warp_install_microcode(drm_mga_private_t * dev_priv) ...@@ -141,7 +141,7 @@ int mga_warp_install_microcode(drm_mga_private_t * dev_priv)
if (size > dev_priv->warp->size) { if (size > dev_priv->warp->size) {
DRM_ERROR("microcode too large! (%u > %lu)\n", DRM_ERROR("microcode too large! (%u > %lu)\n",
size, dev_priv->warp->size); size, dev_priv->warp->size);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
switch (dev_priv->chipset) { switch (dev_priv->chipset) {
...@@ -151,7 +151,7 @@ int mga_warp_install_microcode(drm_mga_private_t * dev_priv) ...@@ -151,7 +151,7 @@ int mga_warp_install_microcode(drm_mga_private_t * dev_priv)
case MGA_CARD_TYPE_G200: case MGA_CARD_TYPE_G200:
return mga_warp_install_g200_microcode(dev_priv); return mga_warp_install_g200_microcode(dev_priv);
default: default:
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
...@@ -177,7 +177,7 @@ int mga_warp_init(drm_mga_private_t * dev_priv) ...@@ -177,7 +177,7 @@ int mga_warp_init(drm_mga_private_t * dev_priv)
MGA_WRITE(MGA_WVRTXSZ, 7); MGA_WRITE(MGA_WVRTXSZ, 7);
break; break;
default: default:
return DRM_ERR(EINVAL); return -EINVAL;
} }
MGA_WRITE(MGA_WMISC, (MGA_WUCODECACHE_ENABLE | MGA_WRITE(MGA_WMISC, (MGA_WUCODECACHE_ENABLE |
...@@ -186,7 +186,7 @@ int mga_warp_init(drm_mga_private_t * dev_priv) ...@@ -186,7 +186,7 @@ int mga_warp_init(drm_mga_private_t * dev_priv)
if (wmisc != WMISC_EXPECTED) { if (wmisc != WMISC_EXPECTED) {
DRM_ERROR("WARP engine config failed! 0x%x != 0x%x\n", DRM_ERROR("WARP engine config failed! 0x%x != 0x%x\n",
wmisc, WMISC_EXPECTED); wmisc, WMISC_EXPECTED);
return DRM_ERR(EINVAL); return -EINVAL;
} }
return 0; return 0;
......
...@@ -129,7 +129,7 @@ static int r128_do_pixcache_flush(drm_r128_private_t * dev_priv) ...@@ -129,7 +129,7 @@ static int r128_do_pixcache_flush(drm_r128_private_t * dev_priv)
#if R128_FIFO_DEBUG #if R128_FIFO_DEBUG
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries) static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries)
...@@ -146,7 +146,7 @@ static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries) ...@@ -146,7 +146,7 @@ static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries)
#if R128_FIFO_DEBUG #if R128_FIFO_DEBUG
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
static int r128_do_wait_for_idle(drm_r128_private_t * dev_priv) static int r128_do_wait_for_idle(drm_r128_private_t * dev_priv)
...@@ -168,7 +168,7 @@ static int r128_do_wait_for_idle(drm_r128_private_t * dev_priv) ...@@ -168,7 +168,7 @@ static int r128_do_wait_for_idle(drm_r128_private_t * dev_priv)
#if R128_FIFO_DEBUG #if R128_FIFO_DEBUG
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
/* ================================================================ /* ================================================================
...@@ -227,7 +227,7 @@ int r128_do_cce_idle(drm_r128_private_t * dev_priv) ...@@ -227,7 +227,7 @@ int r128_do_cce_idle(drm_r128_private_t * dev_priv)
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
r128_status(dev_priv); r128_status(dev_priv);
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
/* Start the Concurrent Command Engine. /* Start the Concurrent Command Engine.
...@@ -355,7 +355,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) ...@@ -355,7 +355,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
dev_priv = drm_alloc(sizeof(drm_r128_private_t), DRM_MEM_DRIVER); dev_priv = drm_alloc(sizeof(drm_r128_private_t), DRM_MEM_DRIVER);
if (dev_priv == NULL) if (dev_priv == NULL)
return DRM_ERR(ENOMEM); return -ENOMEM;
memset(dev_priv, 0, sizeof(drm_r128_private_t)); memset(dev_priv, 0, sizeof(drm_r128_private_t));
...@@ -365,7 +365,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) ...@@ -365,7 +365,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
DRM_ERROR("PCI GART memory not allocated!\n"); DRM_ERROR("PCI GART memory not allocated!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->usec_timeout = init->usec_timeout; dev_priv->usec_timeout = init->usec_timeout;
...@@ -374,7 +374,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) ...@@ -374,7 +374,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
DRM_DEBUG("TIMEOUT problem!\n"); DRM_DEBUG("TIMEOUT problem!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->cce_mode = init->cce_mode; dev_priv->cce_mode = init->cce_mode;
...@@ -394,7 +394,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) ...@@ -394,7 +394,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
DRM_DEBUG("Bad cce_mode!\n"); DRM_DEBUG("Bad cce_mode!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
switch (init->cce_mode) { switch (init->cce_mode) {
...@@ -461,7 +461,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) ...@@ -461,7 +461,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
DRM_ERROR("could not find sarea!\n"); DRM_ERROR("could not find sarea!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset);
...@@ -469,21 +469,21 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) ...@@ -469,21 +469,21 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
DRM_ERROR("could not find mmio region!\n"); DRM_ERROR("could not find mmio region!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->cce_ring = drm_core_findmap(dev, init->ring_offset); dev_priv->cce_ring = drm_core_findmap(dev, init->ring_offset);
if (!dev_priv->cce_ring) { if (!dev_priv->cce_ring) {
DRM_ERROR("could not find cce ring region!\n"); DRM_ERROR("could not find cce ring region!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset);
if (!dev_priv->ring_rptr) { if (!dev_priv->ring_rptr) {
DRM_ERROR("could not find ring read pointer!\n"); DRM_ERROR("could not find ring read pointer!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_token = init->buffers_offset;
dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset);
...@@ -491,7 +491,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) ...@@ -491,7 +491,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
DRM_ERROR("could not find dma buffer region!\n"); DRM_ERROR("could not find dma buffer region!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (!dev_priv->is_pci) { if (!dev_priv->is_pci) {
...@@ -501,7 +501,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) ...@@ -501,7 +501,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
DRM_ERROR("could not find agp texture region!\n"); DRM_ERROR("could not find agp texture region!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
...@@ -520,7 +520,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) ...@@ -520,7 +520,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
DRM_ERROR("Could not ioremap agp regions!\n"); DRM_ERROR("Could not ioremap agp regions!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
} else } else
#endif #endif
...@@ -567,7 +567,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) ...@@ -567,7 +567,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
DRM_ERROR("failed to init PCI GART!\n"); DRM_ERROR("failed to init PCI GART!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
R128_WRITE(R128_PCI_GART_PAGE, dev_priv->gart_info.bus_addr); R128_WRITE(R128_PCI_GART_PAGE, dev_priv->gart_info.bus_addr);
#if __OS_HAS_AGP #if __OS_HAS_AGP
...@@ -644,7 +644,7 @@ int r128_cce_init(DRM_IOCTL_ARGS) ...@@ -644,7 +644,7 @@ int r128_cce_init(DRM_IOCTL_ARGS)
return r128_do_cleanup_cce(dev); return r128_do_cleanup_cce(dev);
} }
return DRM_ERR(EINVAL); return -EINVAL;
} }
int r128_cce_start(DRM_IOCTL_ARGS) int r128_cce_start(DRM_IOCTL_ARGS)
...@@ -721,7 +721,7 @@ int r128_cce_reset(DRM_IOCTL_ARGS) ...@@ -721,7 +721,7 @@ int r128_cce_reset(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_DEBUG("%s called before init done\n", __FUNCTION__); DRM_DEBUG("%s called before init done\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
r128_do_cce_reset(dev_priv); r128_do_cce_reset(dev_priv);
...@@ -759,7 +759,7 @@ int r128_engine_reset(DRM_IOCTL_ARGS) ...@@ -759,7 +759,7 @@ int r128_engine_reset(DRM_IOCTL_ARGS)
int r128_fullscreen(DRM_IOCTL_ARGS) int r128_fullscreen(DRM_IOCTL_ARGS)
{ {
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* ================================================================ /* ================================================================
...@@ -780,7 +780,7 @@ static int r128_freelist_init(struct drm_device * dev) ...@@ -780,7 +780,7 @@ static int r128_freelist_init(struct drm_device * dev)
dev_priv->head = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER); dev_priv->head = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER);
if (dev_priv->head == NULL) if (dev_priv->head == NULL)
return DRM_ERR(ENOMEM); return -ENOMEM;
memset(dev_priv->head, 0, sizeof(drm_r128_freelist_t)); memset(dev_priv->head, 0, sizeof(drm_r128_freelist_t));
dev_priv->head->age = R128_BUFFER_USED; dev_priv->head->age = R128_BUFFER_USED;
...@@ -791,7 +791,7 @@ static int r128_freelist_init(struct drm_device * dev) ...@@ -791,7 +791,7 @@ static int r128_freelist_init(struct drm_device * dev)
entry = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER); entry = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER);
if (!entry) if (!entry)
return DRM_ERR(ENOMEM); return -ENOMEM;
entry->age = R128_BUFFER_FREE; entry->age = R128_BUFFER_FREE;
entry->buf = buf; entry->buf = buf;
...@@ -883,7 +883,7 @@ int r128_wait_ring(drm_r128_private_t * dev_priv, int n) ...@@ -883,7 +883,7 @@ int r128_wait_ring(drm_r128_private_t * dev_priv, int n)
/* FIXME: This is being ignored... */ /* FIXME: This is being ignored... */
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
return DRM_ERR(EBUSY); return -EBUSY;
} }
static int r128_cce_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm_dma * d) static int r128_cce_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm_dma * d)
...@@ -894,16 +894,16 @@ static int r128_cce_get_buffers(DRMFILE filp, struct drm_device * dev, struct dr ...@@ -894,16 +894,16 @@ static int r128_cce_get_buffers(DRMFILE filp, struct drm_device * dev, struct dr
for (i = d->granted_count; i < d->request_count; i++) { for (i = d->granted_count; i < d->request_count; i++) {
buf = r128_freelist_get(dev); buf = r128_freelist_get(dev);
if (!buf) if (!buf)
return DRM_ERR(EAGAIN); return -EAGAIN;
buf->filp = filp; buf->filp = filp;
if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx,
sizeof(buf->idx))) sizeof(buf->idx)))
return DRM_ERR(EFAULT); return -EFAULT;
if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total, if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total,
sizeof(buf->total))) sizeof(buf->total)))
return DRM_ERR(EFAULT); return -EFAULT;
d->granted_count++; d->granted_count++;
} }
...@@ -927,7 +927,7 @@ int r128_cce_buffers(DRM_IOCTL_ARGS) ...@@ -927,7 +927,7 @@ int r128_cce_buffers(DRM_IOCTL_ARGS)
if (d.send_count != 0) { if (d.send_count != 0) {
DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
DRM_CURRENTPID, d.send_count); DRM_CURRENTPID, d.send_count);
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* We'll send you buffers. /* We'll send you buffers.
...@@ -935,7 +935,7 @@ int r128_cce_buffers(DRM_IOCTL_ARGS) ...@@ -935,7 +935,7 @@ int r128_cce_buffers(DRM_IOCTL_ARGS)
if (d.request_count < 0 || d.request_count > dma->buf_count) { if (d.request_count < 0 || d.request_count > dma->buf_count) {
DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
DRM_CURRENTPID, d.request_count, dma->buf_count); DRM_CURRENTPID, d.request_count, dma->buf_count);
return DRM_ERR(EINVAL); return -EINVAL;
} }
d.granted_count = 0; d.granted_count = 0;
......
...@@ -428,7 +428,7 @@ do { \ ...@@ -428,7 +428,7 @@ do { \
DRM_UDELAY(1); \ DRM_UDELAY(1); \
} \ } \
DRM_ERROR( "ring space check failed!\n" ); \ DRM_ERROR( "ring space check failed!\n" ); \
return DRM_ERR(EBUSY); \ return -EBUSY; \
} \ } \
__ring_space_done: \ __ring_space_done: \
; \ ; \
......
This diff is collapsed.
...@@ -74,7 +74,7 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, ...@@ -74,7 +74,7 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,
if (DRM_COPY_FROM_USER_UNCHECKED if (DRM_COPY_FROM_USER_UNCHECKED
(&box, &cmdbuf->boxes[n + i], sizeof(box))) { (&box, &cmdbuf->boxes[n + i], sizeof(box))) {
DRM_ERROR("copy cliprect faulted\n"); DRM_ERROR("copy cliprect faulted\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
box.x1 = box.x1 =
...@@ -263,7 +263,7 @@ static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t * ...@@ -263,7 +263,7 @@ static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t *
DRM_ERROR DRM_ERROR
("Cannot emit more than 64 values at a time (reg=%04x sz=%d)\n", ("Cannot emit more than 64 values at a time (reg=%04x sz=%d)\n",
reg, sz); reg, sz);
return DRM_ERR(EINVAL); return -EINVAL;
} }
for (i = 0; i < sz; i++) { for (i = 0; i < sz; i++) {
values[i] = ((int *)cmdbuf->buf)[i]; values[i] = ((int *)cmdbuf->buf)[i];
...@@ -275,13 +275,13 @@ static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t * ...@@ -275,13 +275,13 @@ static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t *
DRM_ERROR DRM_ERROR
("Offset failed range check (reg=%04x sz=%d)\n", ("Offset failed range check (reg=%04x sz=%d)\n",
reg, sz); reg, sz);
return DRM_ERR(EINVAL); return -EINVAL;
} }
break; break;
default: default:
DRM_ERROR("Register %04x failed check as flag=%02x\n", DRM_ERROR("Register %04x failed check as flag=%02x\n",
reg + i * 4, r300_reg_flags[(reg >> 2) + i]); reg + i * 4, r300_reg_flags[(reg >> 2) + i]);
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
...@@ -317,12 +317,12 @@ static __inline__ int r300_emit_packet0(drm_radeon_private_t *dev_priv, ...@@ -317,12 +317,12 @@ static __inline__ int r300_emit_packet0(drm_radeon_private_t *dev_priv,
return 0; return 0;
if (sz * 4 > cmdbuf->bufsz) if (sz * 4 > cmdbuf->bufsz)
return DRM_ERR(EINVAL); return -EINVAL;
if (reg + sz * 4 >= 0x10000) { if (reg + sz * 4 >= 0x10000) {
DRM_ERROR("No such registers in hardware reg=%04x sz=%d\n", reg, DRM_ERROR("No such registers in hardware reg=%04x sz=%d\n", reg,
sz); sz);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (r300_check_range(reg, sz)) { if (r300_check_range(reg, sz)) {
...@@ -362,7 +362,7 @@ static __inline__ int r300_emit_vpu(drm_radeon_private_t *dev_priv, ...@@ -362,7 +362,7 @@ static __inline__ int r300_emit_vpu(drm_radeon_private_t *dev_priv,
if (!sz) if (!sz)
return 0; return 0;
if (sz * 16 > cmdbuf->bufsz) if (sz * 16 > cmdbuf->bufsz)
return DRM_ERR(EINVAL); return -EINVAL;
BEGIN_RING(5 + sz * 4); BEGIN_RING(5 + sz * 4);
/* Wait for VAP to come to senses.. */ /* Wait for VAP to come to senses.. */
...@@ -391,7 +391,7 @@ static __inline__ int r300_emit_clear(drm_radeon_private_t *dev_priv, ...@@ -391,7 +391,7 @@ static __inline__ int r300_emit_clear(drm_radeon_private_t *dev_priv,
RING_LOCALS; RING_LOCALS;
if (8 * 4 > cmdbuf->bufsz) if (8 * 4 > cmdbuf->bufsz)
return DRM_ERR(EINVAL); return -EINVAL;
BEGIN_RING(10); BEGIN_RING(10);
OUT_RING(CP_PACKET3(R200_3D_DRAW_IMMD_2, 8)); OUT_RING(CP_PACKET3(R200_3D_DRAW_IMMD_2, 8));
...@@ -421,7 +421,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv, ...@@ -421,7 +421,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv,
if ((count + 1) > MAX_ARRAY_PACKET) { if ((count + 1) > MAX_ARRAY_PACKET) {
DRM_ERROR("Too large payload in 3D_LOAD_VBPNTR (count=%d)\n", DRM_ERROR("Too large payload in 3D_LOAD_VBPNTR (count=%d)\n",
count); count);
return DRM_ERR(EINVAL); return -EINVAL;
} }
memset(payload, 0, MAX_ARRAY_PACKET * 4); memset(payload, 0, MAX_ARRAY_PACKET * 4);
memcpy(payload, cmdbuf->buf + 4, (count + 1) * 4); memcpy(payload, cmdbuf->buf + 4, (count + 1) * 4);
...@@ -437,7 +437,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv, ...@@ -437,7 +437,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv,
DRM_ERROR DRM_ERROR
("Offset failed range check (k=%d i=%d) while processing 3D_LOAD_VBPNTR packet.\n", ("Offset failed range check (k=%d i=%d) while processing 3D_LOAD_VBPNTR packet.\n",
k, i); k, i);
return DRM_ERR(EINVAL); return -EINVAL;
} }
k++; k++;
i++; i++;
...@@ -448,7 +448,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv, ...@@ -448,7 +448,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv,
DRM_ERROR DRM_ERROR
("Offset failed range check (k=%d i=%d) while processing 3D_LOAD_VBPNTR packet.\n", ("Offset failed range check (k=%d i=%d) while processing 3D_LOAD_VBPNTR packet.\n",
k, i); k, i);
return DRM_ERR(EINVAL); return -EINVAL;
} }
k++; k++;
i++; i++;
...@@ -458,7 +458,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv, ...@@ -458,7 +458,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv,
DRM_ERROR DRM_ERROR
("Malformed 3D_LOAD_VBPNTR packet (k=%d i=%d narrays=%d count+1=%d).\n", ("Malformed 3D_LOAD_VBPNTR packet (k=%d i=%d narrays=%d count+1=%d).\n",
k, i, narrays, count + 1); k, i, narrays, count + 1);
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* all clear, output packet */ /* all clear, output packet */
...@@ -492,7 +492,7 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv, ...@@ -492,7 +492,7 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv,
ret = !radeon_check_offset(dev_priv, offset); ret = !radeon_check_offset(dev_priv, offset);
if (ret) { if (ret) {
DRM_ERROR("Invalid bitblt first offset is %08X\n", offset); DRM_ERROR("Invalid bitblt first offset is %08X\n", offset);
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
...@@ -502,7 +502,7 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv, ...@@ -502,7 +502,7 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv,
ret = !radeon_check_offset(dev_priv, offset); ret = !radeon_check_offset(dev_priv, offset);
if (ret) { if (ret) {
DRM_ERROR("Invalid bitblt second offset is %08X\n", offset); DRM_ERROR("Invalid bitblt second offset is %08X\n", offset);
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
...@@ -530,12 +530,12 @@ static __inline__ int r300_emit_indx_buffer(drm_radeon_private_t *dev_priv, ...@@ -530,12 +530,12 @@ static __inline__ int r300_emit_indx_buffer(drm_radeon_private_t *dev_priv,
if ((cmd[1] & 0x8000ffff) != 0x80000810) { if ((cmd[1] & 0x8000ffff) != 0x80000810) {
DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]); DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]);
return DRM_ERR(EINVAL); return -EINVAL;
} }
ret = !radeon_check_offset(dev_priv, cmd[2]); ret = !radeon_check_offset(dev_priv, cmd[2]);
if (ret) { if (ret) {
DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]); DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]);
return DRM_ERR(EINVAL); return -EINVAL;
} }
BEGIN_RING(count+2); BEGIN_RING(count+2);
...@@ -557,7 +557,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, ...@@ -557,7 +557,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv,
RING_LOCALS; RING_LOCALS;
if (4 > cmdbuf->bufsz) if (4 > cmdbuf->bufsz)
return DRM_ERR(EINVAL); return -EINVAL;
/* Fixme !! This simply emits a packet without much checking. /* Fixme !! This simply emits a packet without much checking.
We need to be smarter. */ We need to be smarter. */
...@@ -568,7 +568,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, ...@@ -568,7 +568,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv,
/* Is it packet 3 ? */ /* Is it packet 3 ? */
if ((header >> 30) != 0x3) { if ((header >> 30) != 0x3) {
DRM_ERROR("Not a packet3 header (0x%08x)\n", header); DRM_ERROR("Not a packet3 header (0x%08x)\n", header);
return DRM_ERR(EINVAL); return -EINVAL;
} }
count = (header >> 16) & 0x3fff; count = (header >> 16) & 0x3fff;
...@@ -578,7 +578,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, ...@@ -578,7 +578,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv,
DRM_ERROR DRM_ERROR
("Expected packet3 of length %d but have only %d bytes left\n", ("Expected packet3 of length %d but have only %d bytes left\n",
(count + 2) * 4, cmdbuf->bufsz); (count + 2) * 4, cmdbuf->bufsz);
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* Is it a packet type we know about ? */ /* Is it a packet type we know about ? */
...@@ -600,7 +600,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, ...@@ -600,7 +600,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv,
break; break;
default: default:
DRM_ERROR("Unknown packet3 header (0x%08x)\n", header); DRM_ERROR("Unknown packet3 header (0x%08x)\n", header);
return DRM_ERR(EINVAL); return -EINVAL;
} }
BEGIN_RING(count + 2); BEGIN_RING(count + 2);
...@@ -664,7 +664,7 @@ static __inline__ int r300_emit_packet3(drm_radeon_private_t *dev_priv, ...@@ -664,7 +664,7 @@ static __inline__ int r300_emit_packet3(drm_radeon_private_t *dev_priv,
DRM_ERROR("bad packet3 type %i at %p\n", DRM_ERROR("bad packet3 type %i at %p\n",
header.packet3.packet, header.packet3.packet,
cmdbuf->buf - sizeof(header)); cmdbuf->buf - sizeof(header));
return DRM_ERR(EINVAL); return -EINVAL;
} }
n += R300_SIMULTANEOUS_CLIPRECTS; n += R300_SIMULTANEOUS_CLIPRECTS;
...@@ -726,11 +726,11 @@ static int r300_scratch(drm_radeon_private_t *dev_priv, ...@@ -726,11 +726,11 @@ static int r300_scratch(drm_radeon_private_t *dev_priv,
if (cmdbuf->bufsz < if (cmdbuf->bufsz <
(sizeof(u64) + header.scratch.n_bufs * sizeof(buf_idx))) { (sizeof(u64) + header.scratch.n_bufs * sizeof(buf_idx))) {
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (header.scratch.reg >= 5) { if (header.scratch.reg >= 5) {
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->scratch_ages[header.scratch.reg]++; dev_priv->scratch_ages[header.scratch.reg]++;
...@@ -745,21 +745,21 @@ static int r300_scratch(drm_radeon_private_t *dev_priv, ...@@ -745,21 +745,21 @@ static int r300_scratch(drm_radeon_private_t *dev_priv,
buf_idx *= 2; /* 8 bytes per buf */ buf_idx *= 2; /* 8 bytes per buf */
if (DRM_COPY_TO_USER(ref_age_base + buf_idx, &dev_priv->scratch_ages[header.scratch.reg], sizeof(u32))) { if (DRM_COPY_TO_USER(ref_age_base + buf_idx, &dev_priv->scratch_ages[header.scratch.reg], sizeof(u32))) {
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (DRM_COPY_FROM_USER(&h_pending, ref_age_base + buf_idx + 1, sizeof(u32))) { if (DRM_COPY_FROM_USER(&h_pending, ref_age_base + buf_idx + 1, sizeof(u32))) {
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (h_pending == 0) { if (h_pending == 0) {
return DRM_ERR(EINVAL); return -EINVAL;
} }
h_pending--; h_pending--;
if (DRM_COPY_TO_USER(ref_age_base + buf_idx + 1, &h_pending, sizeof(u32))) { if (DRM_COPY_TO_USER(ref_age_base + buf_idx + 1, &h_pending, sizeof(u32))) {
return DRM_ERR(EINVAL); return -EINVAL;
} }
cmdbuf->buf += sizeof(buf_idx); cmdbuf->buf += sizeof(buf_idx);
...@@ -879,7 +879,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, ...@@ -879,7 +879,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev,
if (idx < 0 || idx >= dma->buf_count) { if (idx < 0 || idx >= dma->buf_count) {
DRM_ERROR("buffer index %d (of %d max)\n", DRM_ERROR("buffer index %d (of %d max)\n",
idx, dma->buf_count - 1); idx, dma->buf_count - 1);
ret = DRM_ERR(EINVAL); ret = -EINVAL;
goto cleanup; goto cleanup;
} }
...@@ -887,7 +887,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, ...@@ -887,7 +887,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev,
if (buf->filp != filp || buf->pending) { if (buf->filp != filp || buf->pending) {
DRM_ERROR("bad buffer %p %p %d\n", DRM_ERROR("bad buffer %p %p %d\n",
buf->filp, filp, buf->pending); buf->filp, filp, buf->pending);
ret = DRM_ERR(EINVAL); ret = -EINVAL;
goto cleanup; goto cleanup;
} }
...@@ -924,7 +924,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, ...@@ -924,7 +924,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev,
DRM_ERROR("bad cmd_type %i at %p\n", DRM_ERROR("bad cmd_type %i at %p\n",
header.header.cmd_type, header.header.cmd_type,
cmdbuf->buf - sizeof(header)); cmdbuf->buf - sizeof(header));
ret = DRM_ERR(EINVAL); ret = -EINVAL;
goto cleanup; goto cleanup;
} }
} }
......
...@@ -889,7 +889,7 @@ static int radeon_do_pixcache_flush(drm_radeon_private_t * dev_priv) ...@@ -889,7 +889,7 @@ static int radeon_do_pixcache_flush(drm_radeon_private_t * dev_priv)
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
radeon_status(dev_priv); radeon_status(dev_priv);
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
static int radeon_do_wait_for_fifo(drm_radeon_private_t * dev_priv, int entries) static int radeon_do_wait_for_fifo(drm_radeon_private_t * dev_priv, int entries)
...@@ -910,7 +910,7 @@ static int radeon_do_wait_for_fifo(drm_radeon_private_t * dev_priv, int entries) ...@@ -910,7 +910,7 @@ static int radeon_do_wait_for_fifo(drm_radeon_private_t * dev_priv, int entries)
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
radeon_status(dev_priv); radeon_status(dev_priv);
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv) static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv)
...@@ -936,7 +936,7 @@ static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv) ...@@ -936,7 +936,7 @@ static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv)
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
radeon_status(dev_priv); radeon_status(dev_priv);
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
/* ================================================================ /* ================================================================
...@@ -1394,7 +1394,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) ...@@ -1394,7 +1394,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
if ((dev_priv->flags & RADEON_NEW_MEMMAP) && !dev_priv->new_memmap) { if ((dev_priv->flags & RADEON_NEW_MEMMAP) && !dev_priv->new_memmap) {
DRM_ERROR("Cannot initialise DRM on this card\nThis card requires a new X.org DDX for 3D\n"); DRM_ERROR("Cannot initialise DRM on this card\nThis card requires a new X.org DDX for 3D\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (init->is_pci && (dev_priv->flags & RADEON_IS_AGP)) { if (init->is_pci && (dev_priv->flags & RADEON_IS_AGP)) {
...@@ -1409,7 +1409,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) ...@@ -1409,7 +1409,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
if ((!(dev_priv->flags & RADEON_IS_AGP)) && !dev->sg) { if ((!(dev_priv->flags & RADEON_IS_AGP)) && !dev->sg) {
DRM_ERROR("PCI GART memory not allocated!\n"); DRM_ERROR("PCI GART memory not allocated!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->usec_timeout = init->usec_timeout; dev_priv->usec_timeout = init->usec_timeout;
...@@ -1417,7 +1417,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) ...@@ -1417,7 +1417,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT) { dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT) {
DRM_DEBUG("TIMEOUT problem!\n"); DRM_DEBUG("TIMEOUT problem!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* Enable vblank on CRTC1 for older X servers /* Enable vblank on CRTC1 for older X servers
...@@ -1446,7 +1446,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) ...@@ -1446,7 +1446,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
(init->cp_mode != RADEON_CSQ_PRIBM_INDBM)) { (init->cp_mode != RADEON_CSQ_PRIBM_INDBM)) {
DRM_DEBUG("BAD cp_mode (%x)!\n", init->cp_mode); DRM_DEBUG("BAD cp_mode (%x)!\n", init->cp_mode);
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
switch (init->fb_bpp) { switch (init->fb_bpp) {
...@@ -1515,27 +1515,27 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) ...@@ -1515,27 +1515,27 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
if (!dev_priv->sarea) { if (!dev_priv->sarea) {
DRM_ERROR("could not find sarea!\n"); DRM_ERROR("could not find sarea!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset); dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset);
if (!dev_priv->cp_ring) { if (!dev_priv->cp_ring) {
DRM_ERROR("could not find cp ring region!\n"); DRM_ERROR("could not find cp ring region!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset);
if (!dev_priv->ring_rptr) { if (!dev_priv->ring_rptr) {
DRM_ERROR("could not find ring read pointer!\n"); DRM_ERROR("could not find ring read pointer!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_token = init->buffers_offset;
dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset);
if (!dev->agp_buffer_map) { if (!dev->agp_buffer_map) {
DRM_ERROR("could not find dma buffer region!\n"); DRM_ERROR("could not find dma buffer region!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (init->gart_textures_offset) { if (init->gart_textures_offset) {
...@@ -1544,7 +1544,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) ...@@ -1544,7 +1544,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
if (!dev_priv->gart_textures) { if (!dev_priv->gart_textures) {
DRM_ERROR("could not find GART texture region!\n"); DRM_ERROR("could not find GART texture region!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
...@@ -1562,7 +1562,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) ...@@ -1562,7 +1562,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
!dev->agp_buffer_map->handle) { !dev->agp_buffer_map->handle) {
DRM_ERROR("could not find ioremap agp regions!\n"); DRM_ERROR("could not find ioremap agp regions!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
} else } else
#endif #endif
...@@ -1710,14 +1710,14 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) ...@@ -1710,14 +1710,14 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
DRM_ERROR DRM_ERROR
("Cannot use PCI Express without GART in FB memory\n"); ("Cannot use PCI Express without GART in FB memory\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) { if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) {
DRM_ERROR("failed to init PCI GART!\n"); DRM_ERROR("failed to init PCI GART!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
/* Turn on PCI GART */ /* Turn on PCI GART */
...@@ -1797,7 +1797,7 @@ static int radeon_do_resume_cp(struct drm_device * dev) ...@@ -1797,7 +1797,7 @@ static int radeon_do_resume_cp(struct drm_device * dev)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("Called with no initialization\n"); DRM_ERROR("Called with no initialization\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_DEBUG("Starting radeon_do_resume_cp()\n"); DRM_DEBUG("Starting radeon_do_resume_cp()\n");
...@@ -1845,7 +1845,7 @@ int radeon_cp_init(DRM_IOCTL_ARGS) ...@@ -1845,7 +1845,7 @@ int radeon_cp_init(DRM_IOCTL_ARGS)
return radeon_do_cleanup_cp(dev); return radeon_do_cleanup_cp(dev);
} }
return DRM_ERR(EINVAL); return -EINVAL;
} }
int radeon_cp_start(DRM_IOCTL_ARGS) int radeon_cp_start(DRM_IOCTL_ARGS)
...@@ -1973,7 +1973,7 @@ int radeon_cp_reset(DRM_IOCTL_ARGS) ...@@ -1973,7 +1973,7 @@ int radeon_cp_reset(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_DEBUG("%s called before init done\n", __FUNCTION__); DRM_DEBUG("%s called before init done\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
radeon_do_cp_reset(dev_priv); radeon_do_cp_reset(dev_priv);
...@@ -2167,7 +2167,7 @@ int radeon_wait_ring(drm_radeon_private_t * dev_priv, int n) ...@@ -2167,7 +2167,7 @@ int radeon_wait_ring(drm_radeon_private_t * dev_priv, int n)
radeon_status(dev_priv); radeon_status(dev_priv);
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev, static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev,
...@@ -2179,16 +2179,16 @@ static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev, ...@@ -2179,16 +2179,16 @@ static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev,
for (i = d->granted_count; i < d->request_count; i++) { for (i = d->granted_count; i < d->request_count; i++) {
buf = radeon_freelist_get(dev); buf = radeon_freelist_get(dev);
if (!buf) if (!buf)
return DRM_ERR(EBUSY); /* NOTE: broken client */ return -EBUSY; /* NOTE: broken client */
buf->filp = filp; buf->filp = filp;
if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx,
sizeof(buf->idx))) sizeof(buf->idx)))
return DRM_ERR(EFAULT); return -EFAULT;
if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total, if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total,
sizeof(buf->total))) sizeof(buf->total)))
return DRM_ERR(EFAULT); return -EFAULT;
d->granted_count++; d->granted_count++;
} }
...@@ -2212,7 +2212,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS) ...@@ -2212,7 +2212,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS)
if (d.send_count != 0) { if (d.send_count != 0) {
DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
DRM_CURRENTPID, d.send_count); DRM_CURRENTPID, d.send_count);
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* We'll send you buffers. /* We'll send you buffers.
...@@ -2220,7 +2220,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS) ...@@ -2220,7 +2220,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS)
if (d.request_count < 0 || d.request_count > dma->buf_count) { if (d.request_count < 0 || d.request_count > dma->buf_count) {
DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
DRM_CURRENTPID, d.request_count, dma->buf_count); DRM_CURRENTPID, d.request_count, dma->buf_count);
return DRM_ERR(EINVAL); return -EINVAL;
} }
d.granted_count = 0; d.granted_count = 0;
...@@ -2241,7 +2241,7 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -2241,7 +2241,7 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)
dev_priv = drm_alloc(sizeof(drm_radeon_private_t), DRM_MEM_DRIVER); dev_priv = drm_alloc(sizeof(drm_radeon_private_t), DRM_MEM_DRIVER);
if (dev_priv == NULL) if (dev_priv == NULL)
return DRM_ERR(ENOMEM); return -ENOMEM;
memset(dev_priv, 0, sizeof(drm_radeon_private_t)); memset(dev_priv, 0, sizeof(drm_radeon_private_t));
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
......
...@@ -155,7 +155,7 @@ int radeon_driver_vblank_do_wait(struct drm_device * dev, unsigned int *sequence ...@@ -155,7 +155,7 @@ int radeon_driver_vblank_do_wait(struct drm_device * dev, unsigned int *sequence
atomic_t *counter; atomic_t *counter;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (crtc == DRM_RADEON_VBLANK_CRTC1) { if (crtc == DRM_RADEON_VBLANK_CRTC1) {
...@@ -165,7 +165,7 @@ int radeon_driver_vblank_do_wait(struct drm_device * dev, unsigned int *sequence ...@@ -165,7 +165,7 @@ int radeon_driver_vblank_do_wait(struct drm_device * dev, unsigned int *sequence
counter = &dev->vbl_received2; counter = &dev->vbl_received2;
ack |= RADEON_CRTC2_VBLANK_STAT; ack |= RADEON_CRTC2_VBLANK_STAT;
} else } else
return DRM_ERR(EINVAL); return -EINVAL;
radeon_acknowledge_irqs(dev_priv, ack); radeon_acknowledge_irqs(dev_priv, ack);
...@@ -207,7 +207,7 @@ int radeon_irq_emit(DRM_IOCTL_ARGS) ...@@ -207,7 +207,7 @@ int radeon_irq_emit(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(emit, (drm_radeon_irq_emit_t __user *) data, DRM_COPY_FROM_USER_IOCTL(emit, (drm_radeon_irq_emit_t __user *) data,
...@@ -217,7 +217,7 @@ int radeon_irq_emit(DRM_IOCTL_ARGS) ...@@ -217,7 +217,7 @@ int radeon_irq_emit(DRM_IOCTL_ARGS)
if (DRM_COPY_TO_USER(emit.irq_seq, &result, sizeof(int))) { if (DRM_COPY_TO_USER(emit.irq_seq, &result, sizeof(int))) {
DRM_ERROR("copy_to_user\n"); DRM_ERROR("copy_to_user\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
return 0; return 0;
...@@ -233,7 +233,7 @@ int radeon_irq_wait(DRM_IOCTL_ARGS) ...@@ -233,7 +233,7 @@ int radeon_irq_wait(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(irqwait, (drm_radeon_irq_wait_t __user *) data, DRM_COPY_FROM_USER_IOCTL(irqwait, (drm_radeon_irq_wait_t __user *) data,
...@@ -320,7 +320,7 @@ int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value) ...@@ -320,7 +320,7 @@ int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value)
drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private; drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private;
if (value & ~(DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) { if (value & ~(DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) {
DRM_ERROR("called with invalid crtc 0x%x\n", (unsigned int)value); DRM_ERROR("called with invalid crtc 0x%x\n", (unsigned int)value);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->vblank_crtc = (unsigned int)value; dev_priv->vblank_crtc = (unsigned int)value;
radeon_enable_interrupt(dev); radeon_enable_interrupt(dev);
......
...@@ -137,12 +137,12 @@ static int init_heap(struct mem_block **heap, int start, int size) ...@@ -137,12 +137,12 @@ static int init_heap(struct mem_block **heap, int start, int size)
struct mem_block *blocks = drm_alloc(sizeof(*blocks), DRM_MEM_BUFS); struct mem_block *blocks = drm_alloc(sizeof(*blocks), DRM_MEM_BUFS);
if (!blocks) if (!blocks)
return DRM_ERR(ENOMEM); return -ENOMEM;
*heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFS); *heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFS);
if (!*heap) { if (!*heap) {
drm_free(blocks, sizeof(*blocks), DRM_MEM_BUFS); drm_free(blocks, sizeof(*blocks), DRM_MEM_BUFS);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
blocks->start = start; blocks->start = start;
...@@ -226,7 +226,7 @@ int radeon_mem_alloc(DRM_IOCTL_ARGS) ...@@ -226,7 +226,7 @@ int radeon_mem_alloc(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(alloc, (drm_radeon_mem_alloc_t __user *) data, 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,7 +234,7 @@ int radeon_mem_alloc(DRM_IOCTL_ARGS)
heap = get_heap(dev_priv, alloc.region); heap = get_heap(dev_priv, alloc.region);
if (!heap || !*heap) if (!heap || !*heap)
return DRM_ERR(EFAULT); return -EFAULT;
/* Make things easier on ourselves: all allocations at least /* Make things easier on ourselves: all allocations at least
* 4k aligned. * 4k aligned.
...@@ -245,11 +245,11 @@ int radeon_mem_alloc(DRM_IOCTL_ARGS) ...@@ -245,11 +245,11 @@ int radeon_mem_alloc(DRM_IOCTL_ARGS)
block = alloc_block(*heap, alloc.size, alloc.alignment, filp); block = alloc_block(*heap, alloc.size, alloc.alignment, filp);
if (!block) if (!block)
return DRM_ERR(ENOMEM); return -ENOMEM;
if (DRM_COPY_TO_USER(alloc.region_offset, &block->start, sizeof(int))) { if (DRM_COPY_TO_USER(alloc.region_offset, &block->start, sizeof(int))) {
DRM_ERROR("copy_to_user\n"); DRM_ERROR("copy_to_user\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
return 0; return 0;
...@@ -264,7 +264,7 @@ int radeon_mem_free(DRM_IOCTL_ARGS) ...@@ -264,7 +264,7 @@ int radeon_mem_free(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(memfree, (drm_radeon_mem_free_t __user *) data, 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,14 +272,14 @@ int radeon_mem_free(DRM_IOCTL_ARGS)
heap = get_heap(dev_priv, memfree.region); heap = get_heap(dev_priv, memfree.region);
if (!heap || !*heap) if (!heap || !*heap)
return DRM_ERR(EFAULT); return -EFAULT;
block = find_block(*heap, memfree.region_offset); block = find_block(*heap, memfree.region_offset);
if (!block) if (!block)
return DRM_ERR(EFAULT); return -EFAULT;
if (block->filp != filp) if (block->filp != filp)
return DRM_ERR(EPERM); return -EPERM;
free_block(block); free_block(block);
return 0; return 0;
...@@ -294,7 +294,7 @@ int radeon_mem_init_heap(DRM_IOCTL_ARGS) ...@@ -294,7 +294,7 @@ int radeon_mem_init_heap(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(initheap, DRM_COPY_FROM_USER_IOCTL(initheap,
...@@ -303,11 +303,11 @@ int radeon_mem_init_heap(DRM_IOCTL_ARGS) ...@@ -303,11 +303,11 @@ int radeon_mem_init_heap(DRM_IOCTL_ARGS)
heap = get_heap(dev_priv, initheap.region); heap = get_heap(dev_priv, initheap.region);
if (!heap) if (!heap)
return DRM_ERR(EFAULT); return -EFAULT;
if (*heap) { if (*heap) {
DRM_ERROR("heap already initialized?"); DRM_ERROR("heap already initialized?");
return DRM_ERR(EFAULT); return -EFAULT;
} }
return init_heap(heap, initheap.start, initheap.size); return init_heap(heap, initheap.start, initheap.size);
......
This diff is collapsed.
...@@ -60,7 +60,7 @@ savage_bci_wait_fifo_shadow(drm_savage_private_t * dev_priv, unsigned int n) ...@@ -60,7 +60,7 @@ savage_bci_wait_fifo_shadow(drm_savage_private_t * dev_priv, unsigned int n)
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
DRM_INFO(" status=0x%08x, threshold=0x%08x\n", status, threshold); DRM_INFO(" status=0x%08x, threshold=0x%08x\n", status, threshold);
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
static int static int
...@@ -81,7 +81,7 @@ savage_bci_wait_fifo_s3d(drm_savage_private_t * dev_priv, unsigned int n) ...@@ -81,7 +81,7 @@ savage_bci_wait_fifo_s3d(drm_savage_private_t * dev_priv, unsigned int n)
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
DRM_INFO(" status=0x%08x\n", status); DRM_INFO(" status=0x%08x\n", status);
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
static int static int
...@@ -102,7 +102,7 @@ savage_bci_wait_fifo_s4(drm_savage_private_t * dev_priv, unsigned int n) ...@@ -102,7 +102,7 @@ savage_bci_wait_fifo_s4(drm_savage_private_t * dev_priv, unsigned int n)
DRM_ERROR("failed!\n"); DRM_ERROR("failed!\n");
DRM_INFO(" status=0x%08x\n", status); DRM_INFO(" status=0x%08x\n", status);
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
/* /*
...@@ -136,7 +136,7 @@ savage_bci_wait_event_shadow(drm_savage_private_t * dev_priv, uint16_t e) ...@@ -136,7 +136,7 @@ savage_bci_wait_event_shadow(drm_savage_private_t * dev_priv, uint16_t e)
DRM_INFO(" status=0x%08x, e=0x%04x\n", status, e); DRM_INFO(" status=0x%08x, e=0x%04x\n", status, e);
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
static int static int
...@@ -158,7 +158,7 @@ savage_bci_wait_event_reg(drm_savage_private_t * dev_priv, uint16_t e) ...@@ -158,7 +158,7 @@ savage_bci_wait_event_reg(drm_savage_private_t * dev_priv, uint16_t e)
DRM_INFO(" status=0x%08x, e=0x%04x\n", status, e); DRM_INFO(" status=0x%08x, e=0x%04x\n", status, e);
#endif #endif
return DRM_ERR(EBUSY); return -EBUSY;
} }
uint16_t savage_bci_emit_event(drm_savage_private_t * dev_priv, uint16_t savage_bci_emit_event(drm_savage_private_t * dev_priv,
...@@ -301,7 +301,7 @@ static int savage_dma_init(drm_savage_private_t * dev_priv) ...@@ -301,7 +301,7 @@ static int savage_dma_init(drm_savage_private_t * dev_priv)
dev_priv->dma_pages = drm_alloc(sizeof(drm_savage_dma_page_t) * dev_priv->dma_pages = drm_alloc(sizeof(drm_savage_dma_page_t) *
dev_priv->nr_dma_pages, DRM_MEM_DRIVER); dev_priv->nr_dma_pages, DRM_MEM_DRIVER);
if (dev_priv->dma_pages == NULL) if (dev_priv->dma_pages == NULL)
return DRM_ERR(ENOMEM); return -ENOMEM;
for (i = 0; i < dev_priv->nr_dma_pages; ++i) { for (i = 0; i < dev_priv->nr_dma_pages; ++i) {
SET_AGE(&dev_priv->dma_pages[i].age, 0, 0); SET_AGE(&dev_priv->dma_pages[i].age, 0, 0);
...@@ -541,7 +541,7 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -541,7 +541,7 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset)
dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER); dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER);
if (dev_priv == NULL) if (dev_priv == NULL)
return DRM_ERR(ENOMEM); return -ENOMEM;
memset(dev_priv, 0, sizeof(drm_savage_private_t)); memset(dev_priv, 0, sizeof(drm_savage_private_t));
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
...@@ -682,16 +682,16 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -682,16 +682,16 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
if (init->fb_bpp != 16 && init->fb_bpp != 32) { if (init->fb_bpp != 16 && init->fb_bpp != 32) {
DRM_ERROR("invalid frame buffer bpp %d!\n", init->fb_bpp); DRM_ERROR("invalid frame buffer bpp %d!\n", init->fb_bpp);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (init->depth_bpp != 16 && init->depth_bpp != 32) { if (init->depth_bpp != 16 && init->depth_bpp != 32) {
DRM_ERROR("invalid depth buffer bpp %d!\n", init->fb_bpp); DRM_ERROR("invalid depth buffer bpp %d!\n", init->fb_bpp);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (init->dma_type != SAVAGE_DMA_AGP && if (init->dma_type != SAVAGE_DMA_AGP &&
init->dma_type != SAVAGE_DMA_PCI) { init->dma_type != SAVAGE_DMA_PCI) {
DRM_ERROR("invalid dma memory type %d!\n", init->dma_type); DRM_ERROR("invalid dma memory type %d!\n", init->dma_type);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->cob_size = init->cob_size; dev_priv->cob_size = init->cob_size;
...@@ -715,14 +715,14 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -715,14 +715,14 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
if (!dev_priv->sarea) { if (!dev_priv->sarea) {
DRM_ERROR("could not find sarea!\n"); DRM_ERROR("could not find sarea!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (init->status_offset != 0) { if (init->status_offset != 0) {
dev_priv->status = drm_core_findmap(dev, init->status_offset); dev_priv->status = drm_core_findmap(dev, init->status_offset);
if (!dev_priv->status) { if (!dev_priv->status) {
DRM_ERROR("could not find shadow status region!\n"); DRM_ERROR("could not find shadow status region!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
} else { } else {
dev_priv->status = NULL; dev_priv->status = NULL;
...@@ -734,13 +734,13 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -734,13 +734,13 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
if (!dev->agp_buffer_map) { if (!dev->agp_buffer_map) {
DRM_ERROR("could not find DMA buffer region!\n"); DRM_ERROR("could not find DMA buffer region!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
drm_core_ioremap(dev->agp_buffer_map, dev); drm_core_ioremap(dev->agp_buffer_map, dev);
if (!dev->agp_buffer_map) { if (!dev->agp_buffer_map) {
DRM_ERROR("failed to ioremap DMA buffer region!\n"); DRM_ERROR("failed to ioremap DMA buffer region!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
} }
if (init->agp_textures_offset) { if (init->agp_textures_offset) {
...@@ -749,7 +749,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -749,7 +749,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
if (!dev_priv->agp_textures) { if (!dev_priv->agp_textures) {
DRM_ERROR("could not find agp texture region!\n"); DRM_ERROR("could not find agp texture region!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
} else { } else {
dev_priv->agp_textures = NULL; dev_priv->agp_textures = NULL;
...@@ -760,39 +760,39 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -760,39 +760,39 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
DRM_ERROR("command DMA not supported on " DRM_ERROR("command DMA not supported on "
"Savage3D/MX/IX.\n"); "Savage3D/MX/IX.\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (dev->dma && dev->dma->buflist) { if (dev->dma && dev->dma->buflist) {
DRM_ERROR("command and vertex DMA not supported " DRM_ERROR("command and vertex DMA not supported "
"at the same time.\n"); "at the same time.\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->cmd_dma = drm_core_findmap(dev, init->cmd_dma_offset); dev_priv->cmd_dma = drm_core_findmap(dev, init->cmd_dma_offset);
if (!dev_priv->cmd_dma) { if (!dev_priv->cmd_dma) {
DRM_ERROR("could not find command DMA region!\n"); DRM_ERROR("could not find command DMA region!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (dev_priv->dma_type == SAVAGE_DMA_AGP) { if (dev_priv->dma_type == SAVAGE_DMA_AGP) {
if (dev_priv->cmd_dma->type != _DRM_AGP) { if (dev_priv->cmd_dma->type != _DRM_AGP) {
DRM_ERROR("AGP command DMA region is not a " DRM_ERROR("AGP command DMA region is not a "
"_DRM_AGP map!\n"); "_DRM_AGP map!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
drm_core_ioremap(dev_priv->cmd_dma, dev); drm_core_ioremap(dev_priv->cmd_dma, dev);
if (!dev_priv->cmd_dma->handle) { if (!dev_priv->cmd_dma->handle) {
DRM_ERROR("failed to ioremap command " DRM_ERROR("failed to ioremap command "
"DMA region!\n"); "DMA region!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
} else if (dev_priv->cmd_dma->type != _DRM_CONSISTENT) { } else if (dev_priv->cmd_dma->type != _DRM_CONSISTENT) {
DRM_ERROR("PCI command DMA region is not a " DRM_ERROR("PCI command DMA region is not a "
"_DRM_CONSISTENT map!\n"); "_DRM_CONSISTENT map!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(EINVAL); return -EINVAL;
} }
} else { } else {
dev_priv->cmd_dma = NULL; dev_priv->cmd_dma = NULL;
...@@ -809,7 +809,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -809,7 +809,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
if (!dev_priv->fake_dma.handle) { if (!dev_priv->fake_dma.handle) {
DRM_ERROR("could not allocate faked DMA buffer!\n"); DRM_ERROR("could not allocate faked DMA buffer!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
dev_priv->cmd_dma = &dev_priv->fake_dma; dev_priv->cmd_dma = &dev_priv->fake_dma;
dev_priv->dma_flush = savage_fake_dma_flush; dev_priv->dma_flush = savage_fake_dma_flush;
...@@ -886,13 +886,13 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -886,13 +886,13 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
if (savage_freelist_init(dev) < 0) { if (savage_freelist_init(dev) < 0) {
DRM_ERROR("could not initialize freelist\n"); DRM_ERROR("could not initialize freelist\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
if (savage_dma_init(dev_priv) < 0) { if (savage_dma_init(dev_priv) < 0) {
DRM_ERROR("could not initialize command DMA\n"); DRM_ERROR("could not initialize command DMA\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
return 0; return 0;
...@@ -945,7 +945,7 @@ static int savage_bci_init(DRM_IOCTL_ARGS) ...@@ -945,7 +945,7 @@ static int savage_bci_init(DRM_IOCTL_ARGS)
return savage_do_cleanup_bci(dev); return savage_do_cleanup_bci(dev);
} }
return DRM_ERR(EINVAL); return -EINVAL;
} }
static int savage_bci_event_emit(DRM_IOCTL_ARGS) static int savage_bci_event_emit(DRM_IOCTL_ARGS)
...@@ -1015,16 +1015,16 @@ static int savage_bci_get_buffers(DRMFILE filp, struct drm_device *dev, struct d ...@@ -1015,16 +1015,16 @@ static int savage_bci_get_buffers(DRMFILE filp, struct drm_device *dev, struct d
for (i = d->granted_count; i < d->request_count; i++) { for (i = d->granted_count; i < d->request_count; i++) {
buf = savage_freelist_get(dev); buf = savage_freelist_get(dev);
if (!buf) if (!buf)
return DRM_ERR(EAGAIN); return -EAGAIN;
buf->filp = filp; buf->filp = filp;
if (DRM_COPY_TO_USER(&d->request_indices[i], if (DRM_COPY_TO_USER(&d->request_indices[i],
&buf->idx, sizeof(buf->idx))) &buf->idx, sizeof(buf->idx)))
return DRM_ERR(EFAULT); return -EFAULT;
if (DRM_COPY_TO_USER(&d->request_sizes[i], if (DRM_COPY_TO_USER(&d->request_sizes[i],
&buf->total, sizeof(buf->total))) &buf->total, sizeof(buf->total)))
return DRM_ERR(EFAULT); return -EFAULT;
d->granted_count++; d->granted_count++;
} }
...@@ -1047,7 +1047,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS) ...@@ -1047,7 +1047,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS)
if (d.send_count != 0) { if (d.send_count != 0) {
DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
DRM_CURRENTPID, d.send_count); DRM_CURRENTPID, d.send_count);
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* We'll send you buffers. /* We'll send you buffers.
...@@ -1055,7 +1055,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS) ...@@ -1055,7 +1055,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS)
if (d.request_count < 0 || d.request_count > dma->buf_count) { if (d.request_count < 0 || d.request_count > dma->buf_count) {
DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
DRM_CURRENTPID, d.request_count, dma->buf_count); DRM_CURRENTPID, d.request_count, dma->buf_count);
return DRM_ERR(EINVAL); return -EINVAL;
} }
d.granted_count = 0; d.granted_count = 0;
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -42,7 +42,7 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset)
dev_priv = drm_calloc(1, sizeof(drm_sis_private_t), DRM_MEM_DRIVER); dev_priv = drm_calloc(1, sizeof(drm_sis_private_t), DRM_MEM_DRIVER);
if (dev_priv == NULL) if (dev_priv == NULL)
return DRM_ERR(ENOMEM); return -ENOMEM;
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
dev_priv->chipset = chipset; dev_priv->chipset = chipset;
......
...@@ -140,7 +140,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file * priv, ...@@ -140,7 +140,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file * priv,
dev_priv->agp_initialized)) { dev_priv->agp_initialized)) {
DRM_ERROR DRM_ERROR
("Attempt to allocate from uninitialized memory manager.\n"); ("Attempt to allocate from uninitialized memory manager.\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
mem.size = (mem.size + SIS_MM_ALIGN_MASK) >> SIS_MM_ALIGN_SHIFT; mem.size = (mem.size + SIS_MM_ALIGN_MASK) >> SIS_MM_ALIGN_SHIFT;
...@@ -159,7 +159,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file * priv, ...@@ -159,7 +159,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file * priv,
mem.offset = 0; mem.offset = 0;
mem.size = 0; mem.size = 0;
mem.free = 0; mem.free = 0;
retval = DRM_ERR(ENOMEM); retval = -ENOMEM;
} }
DRM_COPY_TO_USER_IOCTL(argp, mem, sizeof(mem)); DRM_COPY_TO_USER_IOCTL(argp, mem, sizeof(mem));
......
...@@ -175,24 +175,24 @@ static int via_initialize(struct drm_device * dev, ...@@ -175,24 +175,24 @@ static int via_initialize(struct drm_device * dev,
{ {
if (!dev_priv || !dev_priv->mmio) { if (!dev_priv || !dev_priv->mmio) {
DRM_ERROR("via_dma_init called before via_map_init\n"); DRM_ERROR("via_dma_init called before via_map_init\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
if (dev_priv->ring.virtual_start != NULL) { if (dev_priv->ring.virtual_start != NULL) {
DRM_ERROR("%s called again without calling cleanup\n", DRM_ERROR("%s called again without calling cleanup\n",
__FUNCTION__); __FUNCTION__);
return DRM_ERR(EFAULT); return -EFAULT;
} }
if (!dev->agp || !dev->agp->base) { if (!dev->agp || !dev->agp->base) {
DRM_ERROR("%s called with no agp memory available\n", DRM_ERROR("%s called with no agp memory available\n",
__FUNCTION__); __FUNCTION__);
return DRM_ERR(EFAULT); return -EFAULT;
} }
if (dev_priv->chipset == VIA_DX9_0) { if (dev_priv->chipset == VIA_DX9_0) {
DRM_ERROR("AGP DMA is not supported on this chip\n"); DRM_ERROR("AGP DMA is not supported on this chip\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->ring.map.offset = dev->agp->base + init->offset; dev_priv->ring.map.offset = dev->agp->base + init->offset;
...@@ -207,7 +207,7 @@ static int via_initialize(struct drm_device * dev, ...@@ -207,7 +207,7 @@ static int via_initialize(struct drm_device * dev,
via_dma_cleanup(dev); via_dma_cleanup(dev);
DRM_ERROR("can not ioremap virtual address for" DRM_ERROR("can not ioremap virtual address for"
" ring buffer\n"); " ring buffer\n");
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
dev_priv->ring.virtual_start = dev_priv->ring.map.handle; dev_priv->ring.virtual_start = dev_priv->ring.map.handle;
...@@ -240,22 +240,22 @@ static int via_dma_init(DRM_IOCTL_ARGS) ...@@ -240,22 +240,22 @@ static int via_dma_init(DRM_IOCTL_ARGS)
switch (init.func) { switch (init.func) {
case VIA_INIT_DMA: case VIA_INIT_DMA:
if (!DRM_SUSER(DRM_CURPROC)) if (!DRM_SUSER(DRM_CURPROC))
retcode = DRM_ERR(EPERM); retcode = -EPERM;
else else
retcode = via_initialize(dev, dev_priv, &init); retcode = via_initialize(dev, dev_priv, &init);
break; break;
case VIA_CLEANUP_DMA: case VIA_CLEANUP_DMA:
if (!DRM_SUSER(DRM_CURPROC)) if (!DRM_SUSER(DRM_CURPROC))
retcode = DRM_ERR(EPERM); retcode = -EPERM;
else else
retcode = via_dma_cleanup(dev); retcode = via_dma_cleanup(dev);
break; break;
case VIA_DMA_INITIALIZED: case VIA_DMA_INITIALIZED:
retcode = (dev_priv->ring.virtual_start != NULL) ? retcode = (dev_priv->ring.virtual_start != NULL) ?
0 : DRM_ERR(EFAULT); 0 : -EFAULT;
break; break;
default: default:
retcode = DRM_ERR(EINVAL); retcode = -EINVAL;
break; break;
} }
...@@ -273,15 +273,15 @@ static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t * ...@@ -273,15 +273,15 @@ static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t *
if (dev_priv->ring.virtual_start == NULL) { if (dev_priv->ring.virtual_start == NULL) {
DRM_ERROR("%s called without initializing AGP ring buffer.\n", DRM_ERROR("%s called without initializing AGP ring buffer.\n",
__FUNCTION__); __FUNCTION__);
return DRM_ERR(EFAULT); return -EFAULT;
} }
if (cmd->size > VIA_PCI_BUF_SIZE) { if (cmd->size > VIA_PCI_BUF_SIZE) {
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
if (DRM_COPY_FROM_USER(dev_priv->pci_buf, cmd->buf, cmd->size)) if (DRM_COPY_FROM_USER(dev_priv->pci_buf, cmd->buf, cmd->size))
return DRM_ERR(EFAULT); return -EFAULT;
/* /*
* Running this function on AGP memory is dead slow. Therefore * Running this function on AGP memory is dead slow. Therefore
...@@ -297,7 +297,7 @@ static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t * ...@@ -297,7 +297,7 @@ static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t *
vb = via_check_dma(dev_priv, (cmd->size < 0x100) ? 0x102 : cmd->size); vb = via_check_dma(dev_priv, (cmd->size < 0x100) ? 0x102 : cmd->size);
if (vb == NULL) { if (vb == NULL) {
return DRM_ERR(EAGAIN); return -EAGAIN;
} }
memcpy(vb, dev_priv->pci_buf, cmd->size); memcpy(vb, dev_priv->pci_buf, cmd->size);
...@@ -321,7 +321,7 @@ int via_driver_dma_quiescent(struct drm_device * dev) ...@@ -321,7 +321,7 @@ int via_driver_dma_quiescent(struct drm_device * dev)
drm_via_private_t *dev_priv = dev->dev_private; drm_via_private_t *dev_priv = dev->dev_private;
if (!via_wait_idle(dev_priv)) { if (!via_wait_idle(dev_priv)) {
return DRM_ERR(EBUSY); return -EBUSY;
} }
return 0; return 0;
} }
...@@ -363,10 +363,10 @@ static int via_dispatch_pci_cmdbuffer(struct drm_device * dev, ...@@ -363,10 +363,10 @@ static int via_dispatch_pci_cmdbuffer(struct drm_device * dev,
int ret; int ret;
if (cmd->size > VIA_PCI_BUF_SIZE) { if (cmd->size > VIA_PCI_BUF_SIZE) {
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
if (DRM_COPY_FROM_USER(dev_priv->pci_buf, cmd->buf, cmd->size)) if (DRM_COPY_FROM_USER(dev_priv->pci_buf, cmd->buf, cmd->size))
return DRM_ERR(EFAULT); return -EFAULT;
if ((ret = if ((ret =
via_verify_command_stream((uint32_t *) dev_priv->pci_buf, via_verify_command_stream((uint32_t *) dev_priv->pci_buf,
...@@ -669,7 +669,7 @@ static int via_cmdbuf_size(DRM_IOCTL_ARGS) ...@@ -669,7 +669,7 @@ static int via_cmdbuf_size(DRM_IOCTL_ARGS)
if (dev_priv->ring.virtual_start == NULL) { if (dev_priv->ring.virtual_start == NULL) {
DRM_ERROR("%s called without initializing AGP ring buffer.\n", DRM_ERROR("%s called without initializing AGP ring buffer.\n",
__FUNCTION__); __FUNCTION__);
return DRM_ERR(EFAULT); return -EFAULT;
} }
DRM_COPY_FROM_USER_IOCTL(d_siz, (drm_via_cmdbuf_size_t __user *) data, DRM_COPY_FROM_USER_IOCTL(d_siz, (drm_via_cmdbuf_size_t __user *) data,
...@@ -687,7 +687,7 @@ static int via_cmdbuf_size(DRM_IOCTL_ARGS) ...@@ -687,7 +687,7 @@ static int via_cmdbuf_size(DRM_IOCTL_ARGS)
} }
if (!count) { if (!count) {
DRM_ERROR("VIA_CMDBUF_SPACE timed out.\n"); DRM_ERROR("VIA_CMDBUF_SPACE timed out.\n");
ret = DRM_ERR(EAGAIN); ret = -EAGAIN;
} }
break; break;
case VIA_CMDBUF_LAG: case VIA_CMDBUF_LAG:
...@@ -699,11 +699,11 @@ static int via_cmdbuf_size(DRM_IOCTL_ARGS) ...@@ -699,11 +699,11 @@ static int via_cmdbuf_size(DRM_IOCTL_ARGS)
} }
if (!count) { if (!count) {
DRM_ERROR("VIA_CMDBUF_LAG timed out.\n"); DRM_ERROR("VIA_CMDBUF_LAG timed out.\n");
ret = DRM_ERR(EAGAIN); ret = -EAGAIN;
} }
break; break;
default: default:
ret = DRM_ERR(EFAULT); ret = -EFAULT;
} }
d_siz.size = tmp_size; d_siz.size = tmp_size;
......
...@@ -237,7 +237,7 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) ...@@ -237,7 +237,7 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer)
first_pfn + 1; first_pfn + 1;
if (NULL == (vsg->pages = vmalloc(sizeof(struct page *) * vsg->num_pages))) if (NULL == (vsg->pages = vmalloc(sizeof(struct page *) * vsg->num_pages)))
return DRM_ERR(ENOMEM); return -ENOMEM;
memset(vsg->pages, 0, sizeof(struct page *) * vsg->num_pages); memset(vsg->pages, 0, sizeof(struct page *) * vsg->num_pages);
down_read(&current->mm->mmap_sem); down_read(&current->mm->mmap_sem);
ret = get_user_pages(current, current->mm, ret = get_user_pages(current, current->mm,
...@@ -251,7 +251,7 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) ...@@ -251,7 +251,7 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer)
if (ret < 0) if (ret < 0)
return ret; return ret;
vsg->state = dr_via_pages_locked; vsg->state = dr_via_pages_locked;
return DRM_ERR(EINVAL); return -EINVAL;
} }
vsg->state = dr_via_pages_locked; vsg->state = dr_via_pages_locked;
DRM_DEBUG("DMA pages locked\n"); DRM_DEBUG("DMA pages locked\n");
...@@ -274,13 +274,13 @@ via_alloc_desc_pages(drm_via_sg_info_t *vsg) ...@@ -274,13 +274,13 @@ via_alloc_desc_pages(drm_via_sg_info_t *vsg)
vsg->descriptors_per_page; vsg->descriptors_per_page;
if (NULL == (vsg->desc_pages = kcalloc(vsg->num_desc_pages, sizeof(void *), GFP_KERNEL))) if (NULL == (vsg->desc_pages = kcalloc(vsg->num_desc_pages, sizeof(void *), GFP_KERNEL)))
return DRM_ERR(ENOMEM); return -ENOMEM;
vsg->state = dr_via_desc_pages_alloc; vsg->state = dr_via_desc_pages_alloc;
for (i=0; i<vsg->num_desc_pages; ++i) { for (i=0; i<vsg->num_desc_pages; ++i) {
if (NULL == (vsg->desc_pages[i] = if (NULL == (vsg->desc_pages[i] =
(drm_via_descriptor_t *) __get_free_page(GFP_KERNEL))) (drm_via_descriptor_t *) __get_free_page(GFP_KERNEL)))
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
DRM_DEBUG("Allocated %d pages for %d descriptors.\n", vsg->num_desc_pages, DRM_DEBUG("Allocated %d pages for %d descriptors.\n", vsg->num_desc_pages,
vsg->num_desc); vsg->num_desc);
...@@ -593,7 +593,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli ...@@ -593,7 +593,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli
if (xfer->num_lines <= 0 || xfer->line_length <= 0) { if (xfer->num_lines <= 0 || xfer->line_length <= 0) {
DRM_ERROR("Zero size bitblt.\n"); DRM_ERROR("Zero size bitblt.\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* /*
...@@ -606,7 +606,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli ...@@ -606,7 +606,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli
if ((xfer->mem_stride - xfer->line_length) >= PAGE_SIZE) { if ((xfer->mem_stride - xfer->line_length) >= PAGE_SIZE) {
DRM_ERROR("Too large system memory stride. Stride: %d, " DRM_ERROR("Too large system memory stride. Stride: %d, "
"Length: %d\n", xfer->mem_stride, xfer->line_length); "Length: %d\n", xfer->mem_stride, xfer->line_length);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if ((xfer->mem_stride == xfer->line_length) && if ((xfer->mem_stride == xfer->line_length) &&
...@@ -624,7 +624,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli ...@@ -624,7 +624,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli
if (xfer->num_lines > 2048 || (xfer->num_lines*xfer->mem_stride > (2048*2048*4))) { if (xfer->num_lines > 2048 || (xfer->num_lines*xfer->mem_stride > (2048*2048*4))) {
DRM_ERROR("Too large PCI DMA bitblt.\n"); DRM_ERROR("Too large PCI DMA bitblt.\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* /*
...@@ -635,7 +635,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli ...@@ -635,7 +635,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli
if (xfer->mem_stride < xfer->line_length || if (xfer->mem_stride < xfer->line_length ||
abs(xfer->fb_stride) < xfer->line_length) { abs(xfer->fb_stride) < xfer->line_length) {
DRM_ERROR("Invalid frame-buffer / memory stride.\n"); DRM_ERROR("Invalid frame-buffer / memory stride.\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
/* /*
...@@ -648,7 +648,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli ...@@ -648,7 +648,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli
if ((((unsigned long)xfer->mem_addr & 3) != ((unsigned long)xfer->fb_addr & 3)) || if ((((unsigned long)xfer->mem_addr & 3) != ((unsigned long)xfer->fb_addr & 3)) ||
((xfer->num_lines > 1) && ((xfer->mem_stride & 3) != (xfer->fb_stride & 3)))) { ((xfer->num_lines > 1) && ((xfer->mem_stride & 3) != (xfer->fb_stride & 3)))) {
DRM_ERROR("Invalid DRM bitblt alignment.\n"); DRM_ERROR("Invalid DRM bitblt alignment.\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
#else #else
if ((((unsigned long)xfer->mem_addr & 15) || if ((((unsigned long)xfer->mem_addr & 15) ||
...@@ -656,7 +656,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli ...@@ -656,7 +656,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli
((xfer->num_lines > 1) && ((xfer->num_lines > 1) &&
((xfer->mem_stride & 15) || (xfer->fb_stride & 3)))) { ((xfer->mem_stride & 15) || (xfer->fb_stride & 3)))) {
DRM_ERROR("Invalid DRM bitblt alignment.\n"); DRM_ERROR("Invalid DRM bitblt alignment.\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
#endif #endif
...@@ -696,7 +696,7 @@ via_dmablit_grab_slot(drm_via_blitq_t *blitq, int engine) ...@@ -696,7 +696,7 @@ via_dmablit_grab_slot(drm_via_blitq_t *blitq, int engine)
DRM_WAIT_ON(ret, blitq->busy_queue, DRM_HZ, blitq->num_free > 0); DRM_WAIT_ON(ret, blitq->busy_queue, DRM_HZ, blitq->num_free > 0);
if (ret) { if (ret) {
return (DRM_ERR(EINTR) == ret) ? DRM_ERR(EAGAIN) : ret; return (-EINTR == ret) ? -EAGAIN : ret;
} }
spin_lock_irqsave(&blitq->blit_lock, irqsave); spin_lock_irqsave(&blitq->blit_lock, irqsave);
...@@ -740,7 +740,7 @@ via_dmablit(struct drm_device *dev, drm_via_dmablit_t *xfer) ...@@ -740,7 +740,7 @@ via_dmablit(struct drm_device *dev, drm_via_dmablit_t *xfer)
if (dev_priv == NULL) { if (dev_priv == NULL) {
DRM_ERROR("Called without initialization.\n"); DRM_ERROR("Called without initialization.\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
engine = (xfer->to_fb) ? 0 : 1; engine = (xfer->to_fb) ? 0 : 1;
...@@ -750,7 +750,7 @@ via_dmablit(struct drm_device *dev, drm_via_dmablit_t *xfer) ...@@ -750,7 +750,7 @@ via_dmablit(struct drm_device *dev, drm_via_dmablit_t *xfer)
} }
if (NULL == (vsg = kmalloc(sizeof(*vsg), GFP_KERNEL))) { if (NULL == (vsg = kmalloc(sizeof(*vsg), GFP_KERNEL))) {
via_dmablit_release_slot(blitq); via_dmablit_release_slot(blitq);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
if (0 != (ret = via_build_sg_info(dev, vsg, xfer))) { if (0 != (ret = via_build_sg_info(dev, vsg, xfer))) {
via_dmablit_release_slot(blitq); via_dmablit_release_slot(blitq);
...@@ -790,12 +790,12 @@ via_dma_blit_sync( DRM_IOCTL_ARGS ) ...@@ -790,12 +790,12 @@ via_dma_blit_sync( DRM_IOCTL_ARGS )
DRM_COPY_FROM_USER_IOCTL(sync, (drm_via_blitsync_t *)data, sizeof(sync)); DRM_COPY_FROM_USER_IOCTL(sync, (drm_via_blitsync_t *)data, sizeof(sync));
if (sync.engine >= VIA_NUM_BLIT_ENGINES) if (sync.engine >= VIA_NUM_BLIT_ENGINES)
return DRM_ERR(EINVAL); return -EINVAL;
err = via_dmablit_sync(dev, sync.sync_handle, sync.engine); err = via_dmablit_sync(dev, sync.sync_handle, sync.engine);
if (DRM_ERR(EINTR) == err) if (-EINTR == err)
err = DRM_ERR(EAGAIN); err = -EAGAIN;
return err; return err;
} }
......
...@@ -205,13 +205,13 @@ via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequenc ...@@ -205,13 +205,13 @@ via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequenc
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (irq >= drm_via_irq_num) { if (irq >= drm_via_irq_num) {
DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__, DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__,
irq); irq);
return DRM_ERR(EINVAL); return -EINVAL;
} }
real_irq = dev_priv->irq_map[irq]; real_irq = dev_priv->irq_map[irq];
...@@ -219,7 +219,7 @@ via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequenc ...@@ -219,7 +219,7 @@ via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequenc
if (real_irq < 0) { if (real_irq < 0) {
DRM_ERROR("%s Video IRQ %d not available on this hardware.\n", DRM_ERROR("%s Video IRQ %d not available on this hardware.\n",
__FUNCTION__, irq); __FUNCTION__, irq);
return DRM_ERR(EINVAL); return -EINVAL;
} }
masks = dev_priv->irq_masks; masks = dev_priv->irq_masks;
...@@ -343,13 +343,13 @@ int via_wait_irq(DRM_IOCTL_ARGS) ...@@ -343,13 +343,13 @@ int via_wait_irq(DRM_IOCTL_ARGS)
int force_sequence; int force_sequence;
if (!dev->irq) if (!dev->irq)
return DRM_ERR(EINVAL); return -EINVAL;
DRM_COPY_FROM_USER_IOCTL(irqwait, argp, sizeof(irqwait)); DRM_COPY_FROM_USER_IOCTL(irqwait, argp, sizeof(irqwait));
if (irqwait.request.irq >= dev_priv->num_irqs) { if (irqwait.request.irq >= dev_priv->num_irqs) {
DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__, DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__,
irqwait.request.irq); irqwait.request.irq);
return DRM_ERR(EINVAL); return -EINVAL;
} }
cur_irq += irqwait.request.irq; cur_irq += irqwait.request.irq;
...@@ -361,13 +361,13 @@ int via_wait_irq(DRM_IOCTL_ARGS) ...@@ -361,13 +361,13 @@ int via_wait_irq(DRM_IOCTL_ARGS)
case VIA_IRQ_ABSOLUTE: case VIA_IRQ_ABSOLUTE:
break; break;
default: default:
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (irqwait.request.type & VIA_IRQ_SIGNAL) { if (irqwait.request.type & VIA_IRQ_SIGNAL) {
DRM_ERROR("%s Signals on Via IRQs not implemented yet.\n", DRM_ERROR("%s Signals on Via IRQs not implemented yet.\n",
__FUNCTION__); __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
force_sequence = (irqwait.request.type & VIA_IRQ_FORCE_SEQUENCE); force_sequence = (irqwait.request.type & VIA_IRQ_FORCE_SEQUENCE);
......
...@@ -102,7 +102,7 @@ int via_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -102,7 +102,7 @@ int via_driver_load(struct drm_device *dev, unsigned long chipset)
dev_priv = drm_calloc(1, sizeof(drm_via_private_t), DRM_MEM_DRIVER); dev_priv = drm_calloc(1, sizeof(drm_via_private_t), DRM_MEM_DRIVER);
if (dev_priv == NULL) if (dev_priv == NULL)
return DRM_ERR(ENOMEM); return -ENOMEM;
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
......
...@@ -136,7 +136,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS) ...@@ -136,7 +136,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS)
if (mem.type > VIA_MEM_AGP) { if (mem.type > VIA_MEM_AGP) {
DRM_ERROR("Unknown memory type allocation\n"); DRM_ERROR("Unknown memory type allocation\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
if (0 == ((mem.type == VIA_MEM_VIDEO) ? dev_priv->vram_initialized : if (0 == ((mem.type == VIA_MEM_VIDEO) ? dev_priv->vram_initialized :
...@@ -144,7 +144,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS) ...@@ -144,7 +144,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS)
DRM_ERROR DRM_ERROR
("Attempt to allocate from uninitialized memory manager.\n"); ("Attempt to allocate from uninitialized memory manager.\n");
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return DRM_ERR(EINVAL); return -EINVAL;
} }
tmpSize = (mem.size + VIA_MM_ALIGN_MASK) >> VIA_MM_ALIGN_SHIFT; tmpSize = (mem.size + VIA_MM_ALIGN_MASK) >> VIA_MM_ALIGN_SHIFT;
...@@ -162,7 +162,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS) ...@@ -162,7 +162,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS)
mem.size = 0; mem.size = 0;
mem.index = 0; mem.index = 0;
DRM_DEBUG("Video memory allocation failed\n"); DRM_DEBUG("Video memory allocation failed\n");
retval = DRM_ERR(ENOMEM); retval = -ENOMEM;
} }
DRM_COPY_TO_USER_IOCTL((drm_via_mem_t __user *) data, mem, sizeof(mem)); DRM_COPY_TO_USER_IOCTL((drm_via_mem_t __user *) data, mem, sizeof(mem));
......
...@@ -1026,12 +1026,12 @@ via_verify_command_stream(const uint32_t * buf, unsigned int size, ...@@ -1026,12 +1026,12 @@ via_verify_command_stream(const uint32_t * buf, unsigned int size,
case state_error: case state_error:
default: default:
*hc_state = saved_state; *hc_state = saved_state;
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
if (state == state_error) { if (state == state_error) {
*hc_state = saved_state; *hc_state = saved_state;
return DRM_ERR(EINVAL); return -EINVAL;
} }
return 0; return 0;
} }
...@@ -1082,11 +1082,11 @@ via_parse_command_stream(struct drm_device * dev, const uint32_t * buf, ...@@ -1082,11 +1082,11 @@ via_parse_command_stream(struct drm_device * dev, const uint32_t * buf,
break; break;
case state_error: case state_error:
default: default:
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
if (state == state_error) { if (state == state_error) {
return DRM_ERR(EINVAL); return -EINVAL;
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment