Skip to content

Commit

Permalink
Input: return -ENOMEM in select drivers when memory allocation fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Davidlohr Bueso authored and Dmitry Torokhov committed Oct 13, 2010
1 parent 7aed3fb commit 6792cbb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/input/misc/powermate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/mouse/elantech.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/mouse/synaptics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion drivers/input/mouse/trackpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 6792cbb

Please sign in to comment.