]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/platforms/cell/spufs/file.c
Merge git://git.infradead.org/mtd-2.6
[linux-2.6-omap-h63xx.git] / arch / powerpc / platforms / cell / spufs / file.c
index f139cd8b594db6accac1757788feb5c9892d65d6..b73c369cc6f167a4fa52c9162cfed557c9c1bba0 100644 (file)
@@ -548,6 +548,11 @@ spufs_regs_read(struct file *file, char __user *buffer,
        int ret;
        struct spu_context *ctx = file->private_data;
 
+       /* pre-check for file position: if we'd return EOF, there's no point
+        * causing a deschedule */
+       if (*pos >= sizeof(ctx->csa.lscsa->gprs))
+               return 0;
+
        ret = spu_acquire_saved(ctx);
        if (ret)
                return ret;
@@ -2437,7 +2442,7 @@ static int spufs_switch_log_open(struct inode *inode, struct file *file)
                goto out;
        }
 
-       ctx->switch_log = kzalloc(sizeof(struct switch_log) +
+       ctx->switch_log = kmalloc(sizeof(struct switch_log) +
                SWITCH_LOG_BUFSIZE * sizeof(struct switch_log_entry),
                GFP_KERNEL);
 
@@ -2446,6 +2451,7 @@ static int spufs_switch_log_open(struct inode *inode, struct file *file)
                goto out;
        }
 
+       ctx->switch_log->head = ctx->switch_log->tail = 0;
        init_waitqueue_head(&ctx->switch_log->wait);
        rc = 0;