[PATCH] joystick kmalloc error (2.3.99-pre5)

From: jbmsnm@pacbell.net
Date: Wed Apr 19 2000 - 10:51:02 EST


I got a memory allocation error when trying to load the joystick module. I
noticed that the js_open() routine was incorrectly returning an error when the
allocation was successful, rather than when it failed!

Jonathan

--- linux-2.3.99-pre5/drivers/char/joystick/joystick.c Sat Apr 15 17:13:00 2000
+++ linux/drivers/char/joystick/joystick.c Sat Apr 15 17:12:42 2000
@@ -516,7 +516,7 @@
 
         MOD_INC_USE_COUNT;
 
- if ((new = kmalloc(sizeof(struct js_list), GFP_KERNEL))) {
+ if (!(new = kmalloc(sizeof(struct js_list), GFP_KERNEL))) {
                 MOD_DEC_USE_COUNT;
                 return -ENOMEM;
         }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:15 EST