* [PATCH] input: for best practices, return -ENOMEM instead of -1 when returning on mem allocation errors
@ 2010-09-23 14:14 Davidlohr Bueso
2010-09-23 15:44 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Davidlohr Bueso @ 2010-09-23 14:14 UTC (permalink / raw)
To: dmitry.torokhov, dtor; +Cc: LKML, linux-input
input: for best practices, return -ENOMEM instead of -1 when returning on mem allocation errors.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
drivers/input/misc/powermate.c | 2 +-
drivers/input/mouse/elantech.c | 2 +-
drivers/input/mouse/synaptics.c | 2 +-
drivers/input/mouse/trackpoint.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index bf170f6..f459471 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -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;
}
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 4831120..04d9bf3 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -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++)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 96b70a4..a79bc36 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -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);
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
index 0643e49..54b2fa8 100644
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -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";
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] input: for best practices, return -ENOMEM instead of -1 when returning on mem allocation errors
2010-09-23 14:14 [PATCH] input: for best practices, return -ENOMEM instead of -1 when returning on mem allocation errors Davidlohr Bueso
@ 2010-09-23 15:44 ` Dmitry Torokhov
2010-09-23 20:56 ` Davidlohr Bueso
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2010-09-23 15:44 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: LKML, linux-input
On Thu, Sep 23, 2010 at 10:14:05AM -0400, Davidlohr Bueso wrote:
> input: for best practices, return -ENOMEM instead of -1 when returning on mem allocation errors.
>
> Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Applied, thank you Davidlohr.
FWIW there are more code in drivers/input/serio and drivers/input/mouse/
that return -1 instead of a proper error codes.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] input: for best practices, return -ENOMEM instead of -1 when returning on mem allocation errors
2010-09-23 15:44 ` Dmitry Torokhov
@ 2010-09-23 20:56 ` Davidlohr Bueso
0 siblings, 0 replies; 3+ messages in thread
From: Davidlohr Bueso @ 2010-09-23 20:56 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: LKML, linux-input
On Thu, 2010-09-23 at 08:44 -0700, Dmitry Torokhov wrote:
> On Thu, Sep 23, 2010 at 10:14:05AM -0400, Davidlohr Bueso wrote:
> > input: for best practices, return -ENOMEM instead of -1 when returning on mem allocation errors.
> >
> > Signed-off-by: Davidlohr Bueso <dave@gnu.org>
>
> Applied, thank you Davidlohr.
>
> FWIW there are more code in drivers/input/serio and drivers/input/mouse/
> that return -1 instead of a proper error codes.
>
Yes, I'll be preparing a patch shortly for those.
Thanks,
Davidlohr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-23 20:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-23 14:14 [PATCH] input: for best practices, return -ENOMEM instead of -1 when returning on mem allocation errors Davidlohr Bueso
2010-09-23 15:44 ` Dmitry Torokhov
2010-09-23 20:56 ` Davidlohr Bueso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).