Input: return -ENOMEM in select drivers when memory allocation fails
authorDavidlohr Bueso <dave@gnu.org>
Thu, 30 Sep 2010 01:53:35 +0000 (18:53 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 13 Oct 2010 14:49:23 +0000 (07:49 -0700)
Instead of using -1 let's start using proper error codes.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/misc/powermate.c
drivers/input/mouse/elantech.c
drivers/input/mouse/synaptics.c
drivers/input/mouse/trackpoint.c

index bf170f6b4422676889658959af884834d8e81efb..f45947190e4fcb07668adeec9734ea28418df481 100644 (file)
@@ -280,7 +280,7 @@ static int powermate_alloc_buffers(struct usb_device *udev, struct powermate_dev
 
        pm->configcr = kmalloc(sizeof(*(pm->configcr)), GFP_KERNEL);
        if (!pm->configcr)
-               return -1;
+               return -ENOMEM;
 
        return 0;
 }
index 48311204ba51a76fbc90f7f3194e6a2f79e5a403..04d9bf320a4f9c090b8d4f46aeca8e848bc4f988 100644 (file)
@@ -699,7 +699,7 @@ int elantech_init(struct psmouse *psmouse)
 
        psmouse->private = etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL);
        if (!etd)
-               return -1;
+               return -ENOMEM;
 
        etd->parity[0] = 1;
        for (i = 1; i < 256; i++)
index 96b70a43515f034ff5c1c02b8ec7a35674afb394..a79bc362dde55eaf14ada0fbb843f1d889d1d020 100644 (file)
@@ -731,7 +731,7 @@ int synaptics_init(struct psmouse *psmouse)
 
        psmouse->private = priv = kzalloc(sizeof(struct synaptics_data), GFP_KERNEL);
        if (!priv)
-               return -1;
+               return -ENOMEM;
 
        psmouse_reset(psmouse);
 
index 0643e49ca6039ea239e777c0b7f695040fed53bb..54b2fa892e1941b76d3d863013b85a4884595770 100644 (file)
@@ -303,7 +303,7 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
 
        psmouse->private = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL);
        if (!psmouse->private)
-               return -1;
+               return -ENOMEM;
 
        psmouse->vendor = "IBM";
        psmouse->name = "TrackPoint";