diff options
| author | Dave Airlie <airlied@redhat.com> | 2011-01-05 08:31:08 +1000 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2011-01-05 08:31:08 +1000 |
| commit | 4f125010d2d02c481a0fdf5aee23a9f937bc5de1 (patch) | |
| tree | dcdcd2ba1d0bb980b57ced9a1b2b5b17c84c8f57 /arch/mips/kernel/vpe.c | |
| parent | 204663c48711ddceee09df46269cd34d49d1f7be (diff) | |
| parent | 989d873fc5b6a96695b97738dea8d9f02a60f8ab (diff) | |
Merge branch 'master' of /home/airlied/kernel/linux-2.6 into drm-core-next
Diffstat (limited to 'arch/mips/kernel/vpe.c')
| -rw-r--r-- | arch/mips/kernel/vpe.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 3eb3cde2f66..6a1fdfef8fd 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c @@ -1092,6 +1092,10 @@ static int vpe_open(struct inode *inode, struct file *filp) /* this of-course trashes what was there before... */ v->pbuffer = vmalloc(P_SIZE); + if (!v->pbuffer) { + pr_warning("VPE loader: unable to allocate memory\n"); + return -ENOMEM; + } v->plen = P_SIZE; v->load_addr = NULL; v->len = 0; @@ -1149,10 +1153,9 @@ static int vpe_release(struct inode *inode, struct file *filp) if (ret < 0) v->shared_ptr = NULL; - // cleanup any temp buffers - if (v->pbuffer) - vfree(v->pbuffer); + vfree(v->pbuffer); v->plen = 0; + return ret; } @@ -1169,11 +1172,6 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer, if (v == NULL) return -ENODEV; - if (v->pbuffer == NULL) { - printk(KERN_ERR "VPE loader: no buffer for program\n"); - return -ENOMEM; - } - if ((count + v->len) > v->plen) { printk(KERN_WARNING "VPE loader: elf size too big. Perhaps strip uneeded symbols\n"); |
