summaryrefslogtreecommitdiffstats
path: root/drivers/char/joystick/joystick.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/joystick/joystick.c')
-rw-r--r--drivers/char/joystick/joystick.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/char/joystick/joystick.c b/drivers/char/joystick/joystick.c
index d0dc70f55..1b156538e 100644
--- a/drivers/char/joystick/joystick.c
+++ b/drivers/char/joystick/joystick.c
@@ -516,7 +516,9 @@ static int js_open(struct inode *inode, struct file *file)
MOD_INC_USE_COUNT;
- if ((new = kmalloc(sizeof(struct js_list), GFP_KERNEL))) {
+ new = kmalloc(sizeof(struct js_list), GFP_KERNEL);
+ if (!new) {
+ jd->close(jd);
MOD_DEC_USE_COUNT;
return -ENOMEM;
}