aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/mga_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/mga_state.c')
-rw-r--r--drivers/char/drm/mga_state.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/char/drm/mga_state.c b/drivers/char/drm/mga_state.c
index d448b0aef33c..4e9867161170 100644
--- a/drivers/char/drm/mga_state.c
+++ b/drivers/char/drm/mga_state.c
@@ -392,7 +392,7 @@ static int mga_verify_context(drm_mga_private_t * dev_priv)
392 ctx->dstorg, dev_priv->front_offset, 392 ctx->dstorg, dev_priv->front_offset,
393 dev_priv->back_offset); 393 dev_priv->back_offset);
394 ctx->dstorg = 0; 394 ctx->dstorg = 0;
395 return DRM_ERR(EINVAL); 395 return -EINVAL;
396 } 396 }
397 397
398 return 0; 398 return 0;
@@ -411,7 +411,7 @@ static int mga_verify_tex(drm_mga_private_t * dev_priv, int unit)
411 if (org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI)) { 411 if (org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI)) {
412 DRM_ERROR("*** bad TEXORG: 0x%x, unit %d\n", tex->texorg, unit); 412 DRM_ERROR("*** bad TEXORG: 0x%x, unit %d\n", tex->texorg, unit);
413 tex->texorg = 0; 413 tex->texorg = 0;
414 return DRM_ERR(EINVAL); 414 return -EINVAL;
415 } 415 }
416 416
417 return 0; 417 return 0;
@@ -453,13 +453,13 @@ static int mga_verify_iload(drm_mga_private_t * dev_priv,
453 dstorg + length > (dev_priv->texture_offset + 453 dstorg + length > (dev_priv->texture_offset +
454 dev_priv->texture_size)) { 454 dev_priv->texture_size)) {
455 DRM_ERROR("*** bad iload DSTORG: 0x%x\n", dstorg); 455 DRM_ERROR("*** bad iload DSTORG: 0x%x\n", dstorg);
456 return DRM_ERR(EINVAL); 456 return -EINVAL;
457 } 457 }
458 458
459 if (length & MGA_ILOAD_MASK) { 459 if (length & MGA_ILOAD_MASK) {
460 DRM_ERROR("*** bad iload length: 0x%x\n", 460 DRM_ERROR("*** bad iload length: 0x%x\n",
461 length & MGA_ILOAD_MASK); 461 length & MGA_ILOAD_MASK);
462 return DRM_ERR(EINVAL); 462 return -EINVAL;
463 } 463 }
464 464
465 return 0; 465 return 0;
@@ -471,7 +471,7 @@ static int mga_verify_blit(drm_mga_private_t * dev_priv,
471 if ((srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) || 471 if ((srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ||
472 (dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM)) { 472 (dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM)) {
473 DRM_ERROR("*** bad blit: src=0x%x dst=0x%x\n", srcorg, dstorg); 473 DRM_ERROR("*** bad blit: src=0x%x dst=0x%x\n", srcorg, dstorg);
474 return DRM_ERR(EINVAL); 474 return -EINVAL;
475 } 475 }
476 return 0; 476 return 0;
477} 477}
@@ -892,7 +892,7 @@ static int mga_dma_vertex(DRM_IOCTL_ARGS)
892 sizeof(vertex)); 892 sizeof(vertex));
893 893
894 if (vertex.idx < 0 || vertex.idx > dma->buf_count) 894 if (vertex.idx < 0 || vertex.idx > dma->buf_count)
895 return DRM_ERR(EINVAL); 895 return -EINVAL;
896 buf = dma->buflist[vertex.idx]; 896 buf = dma->buflist[vertex.idx];
897 buf_priv = buf->dev_private; 897 buf_priv = buf->dev_private;
898 898
@@ -906,7 +906,7 @@ static int mga_dma_vertex(DRM_IOCTL_ARGS)
906 buf_priv->dispatched = 0; 906 buf_priv->dispatched = 0;
907 mga_freelist_put(dev, buf); 907 mga_freelist_put(dev, buf);
908 } 908 }
909 return DRM_ERR(EINVAL); 909 return -EINVAL;
910 } 910 }
911 911
912 WRAP_TEST_WITH_RETURN(dev_priv); 912 WRAP_TEST_WITH_RETURN(dev_priv);
@@ -932,7 +932,7 @@ static int mga_dma_indices(DRM_IOCTL_ARGS)
932 sizeof(indices)); 932 sizeof(indices));
933 933
934 if (indices.idx < 0 || indices.idx > dma->buf_count) 934 if (indices.idx < 0 || indices.idx > dma->buf_count)
935 return DRM_ERR(EINVAL); 935 return -EINVAL;
936 936
937 buf = dma->buflist[indices.idx]; 937 buf = dma->buflist[indices.idx];
938 buf_priv = buf->dev_private; 938 buf_priv = buf->dev_private;
@@ -946,7 +946,7 @@ static int mga_dma_indices(DRM_IOCTL_ARGS)
946 buf_priv->dispatched = 0; 946 buf_priv->dispatched = 0;
947 mga_freelist_put(dev, buf); 947 mga_freelist_put(dev, buf);
948 } 948 }
949 return DRM_ERR(EINVAL); 949 return -EINVAL;
950 } 950 }
951 951
952 WRAP_TEST_WITH_RETURN(dev_priv); 952 WRAP_TEST_WITH_RETURN(dev_priv);
@@ -975,18 +975,18 @@ static int mga_dma_iload(DRM_IOCTL_ARGS)
975 if (mga_do_wait_for_idle(dev_priv) < 0) { 975 if (mga_do_wait_for_idle(dev_priv) < 0) {
976 if (MGA_DMA_DEBUG) 976 if (MGA_DMA_DEBUG)
977 DRM_INFO("%s: -EBUSY\n", __FUNCTION__); 977 DRM_INFO("%s: -EBUSY\n", __FUNCTION__);
978 return DRM_ERR(EBUSY); 978 return -EBUSY;
979 } 979 }
980#endif 980#endif
981 if (iload.idx < 0 || iload.idx > dma->buf_count) 981 if (iload.idx < 0 || iload.idx > dma->buf_count)
982 return DRM_ERR(EINVAL); 982 return -EINVAL;
983 983
984 buf = dma->buflist[iload.idx]; 984 buf = dma->buflist[iload.idx];
985 buf_priv = buf->dev_private; 985 buf_priv = buf->dev_private;
986 986
987 if (mga_verify_iload(dev_priv, iload.dstorg, iload.length)) { 987 if (mga_verify_iload(dev_priv, iload.dstorg, iload.length)) {
988 mga_freelist_put(dev, buf); 988 mga_freelist_put(dev, buf);
989 return DRM_ERR(EINVAL); 989 return -EINVAL;
990 } 990 }
991 991
992 WRAP_TEST_WITH_RETURN(dev_priv); 992 WRAP_TEST_WITH_RETURN(dev_priv);
@@ -1017,7 +1017,7 @@ static int mga_dma_blit(DRM_IOCTL_ARGS)
1017 sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; 1017 sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
1018 1018
1019 if (mga_verify_blit(dev_priv, blit.srcorg, blit.dstorg)) 1019 if (mga_verify_blit(dev_priv, blit.srcorg, blit.dstorg))
1020 return DRM_ERR(EINVAL); 1020 return -EINVAL;
1021 1021
1022 WRAP_TEST_WITH_RETURN(dev_priv); 1022 WRAP_TEST_WITH_RETURN(dev_priv);
1023 1023
@@ -1039,7 +1039,7 @@ static int mga_getparam(DRM_IOCTL_ARGS)
1039 1039
1040 if (!dev_priv) { 1040 if (!dev_priv) {
1041 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 1041 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
1042 return DRM_ERR(EINVAL); 1042 return -EINVAL;
1043 } 1043 }
1044 1044
1045 DRM_COPY_FROM_USER_IOCTL(param, (drm_mga_getparam_t __user *) data, 1045 DRM_COPY_FROM_USER_IOCTL(param, (drm_mga_getparam_t __user *) data,
@@ -1055,12 +1055,12 @@ static int mga_getparam(DRM_IOCTL_ARGS)
1055 value = dev_priv->chipset; 1055 value = dev_priv->chipset;
1056 break; 1056 break;
1057 default: 1057 default:
1058 return DRM_ERR(EINVAL); 1058 return -EINVAL;
1059 } 1059 }
1060 1060
1061 if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) { 1061 if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) {
1062 DRM_ERROR("copy_to_user\n"); 1062 DRM_ERROR("copy_to_user\n");
1063 return DRM_ERR(EFAULT); 1063 return -EFAULT;
1064 } 1064 }
1065 1065
1066 return 0; 1066 return 0;
@@ -1075,7 +1075,7 @@ static int mga_set_fence(DRM_IOCTL_ARGS)
1075 1075
1076 if (!dev_priv) { 1076 if (!dev_priv) {
1077 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 1077 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
1078 return DRM_ERR(EINVAL); 1078 return -EINVAL;
1079 } 1079 }
1080 1080
1081 DRM_DEBUG("pid=%d\n", DRM_CURRENTPID); 1081 DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
@@ -1095,7 +1095,7 @@ static int mga_set_fence(DRM_IOCTL_ARGS)
1095 1095
1096 if (DRM_COPY_TO_USER((u32 __user *) data, &temp, sizeof(u32))) { 1096 if (DRM_COPY_TO_USER((u32 __user *) data, &temp, sizeof(u32))) {
1097 DRM_ERROR("copy_to_user\n"); 1097 DRM_ERROR("copy_to_user\n");
1098 return DRM_ERR(EFAULT); 1098 return -EFAULT;
1099 } 1099 }
1100 1100
1101 return 0; 1101 return 0;
@@ -1109,7 +1109,7 @@ static int mga_wait_fence(DRM_IOCTL_ARGS)
1109 1109
1110 if (!dev_priv) { 1110 if (!dev_priv) {
1111 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 1111 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
1112 return DRM_ERR(EINVAL); 1112 return -EINVAL;
1113 } 1113 }
1114 1114
1115 DRM_COPY_FROM_USER_IOCTL(fence, (u32 __user *) data, sizeof(u32)); 1115 DRM_COPY_FROM_USER_IOCTL(fence, (u32 __user *) data, sizeof(u32));
@@ -1120,7 +1120,7 @@ static int mga_wait_fence(DRM_IOCTL_ARGS)
1120 1120
1121 if (DRM_COPY_TO_USER((u32 __user *) data, &fence, sizeof(u32))) { 1121 if (DRM_COPY_TO_USER((u32 __user *) data, &fence, sizeof(u32))) {
1122 DRM_ERROR("copy_to_user\n"); 1122 DRM_ERROR("copy_to_user\n");
1123 return DRM_ERR(EFAULT); 1123 return -EFAULT;
1124 } 1124 }
1125 1125
1126 return 0; 1126 return 0;