aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/glamo/glamo-cmdq.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/mfd/glamo/glamo-cmdq.c b/drivers/mfd/glamo/glamo-cmdq.c
index f7bb0be678e..215017d86ba 100644
--- a/drivers/mfd/glamo/glamo-cmdq.c
+++ b/drivers/mfd/glamo/glamo-cmdq.c
@@ -125,6 +125,11 @@ static int glamo_add_to_ring(struct glamodrm_handle *gdrm, u16 *addr,
size_t ring_write, ring_read;
size_t new_ring_write;
+ if ( count >= GLAMO_CMDQ_SIZE ) {
+ printk(KERN_WARNING "[glamo-drm] CmdQ submission too large\n");
+ return -EINVAL;
+ }
+
down(&gdrm->add_to_ring);
ring_write = glamo_get_write(gdrm);
@@ -170,16 +175,6 @@ static int glamo_add_to_ring(struct glamodrm_handle *gdrm, u16 *addr,
new_ring_write = 4;
}
- /* Suppose we just filled the WHOLE ring buffer, and so the
- * write position ends up in the same place as it started.
- * No change in poginter means no activity from the command
- * queue engine. So, insert a no-op */
- if (ring_write == new_ring_write) {
- iowrite16(0x0000, gdrm->cmdq_base + new_ring_write);
- iowrite16(0x0000, gdrm->cmdq_base + new_ring_write + 2);
- new_ring_write += 4;
- }
-
} else {
memcpy_toio(gdrm->cmdq_base+ring_write, addr, count);