aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index 43e0b187ffde..91d564df944e 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -37,11 +37,12 @@ asmlinkage long sys_spu_create(const char __user *name,
37 unsigned int flags, mode_t mode) 37 unsigned int flags, mode_t mode)
38{ 38{
39 long ret; 39 long ret;
40 struct module *owner = spufs_calls.owner;
40 41
41 ret = -ENOSYS; 42 ret = -ENOSYS;
42 if (try_module_get(spufs_calls.owner)) { 43 if (owner && try_module_get(spufs_calls.owner)) {
43 ret = spufs_calls.create_thread(name, flags, mode); 44 ret = spufs_calls.create_thread(name, flags, mode);
44 module_put(spufs_calls.owner); 45 module_put(owner);
45 } 46 }
46 return ret; 47 return ret;
47} 48}
@@ -51,16 +52,17 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus)
51 long ret; 52 long ret;
52 struct file *filp; 53 struct file *filp;
53 int fput_needed; 54 int fput_needed;
55 struct module *owner = spufs_calls.owner;
54 56
55 ret = -ENOSYS; 57 ret = -ENOSYS;
56 if (try_module_get(spufs_calls.owner)) { 58 if (owner && try_module_get(owner)) {
57 ret = -EBADF; 59 ret = -EBADF;
58 filp = fget_light(fd, &fput_needed); 60 filp = fget_light(fd, &fput_needed);
59 if (filp) { 61 if (filp) {
60 ret = spufs_calls.spu_run(filp, unpc, ustatus); 62 ret = spufs_calls.spu_run(filp, unpc, ustatus);
61 fput_light(filp, fput_needed); 63 fput_light(filp, fput_needed);
62 } 64 }
63 module_put(spufs_calls.owner); 65 module_put(owner);
64 } 66 }
65 return ret; 67 return ret;
66} 68}