aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-11-02 23:59:30 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-02 23:59:30 -0500
commit8ff22ea7d29d99b3dbec08fd541eb406c6775ec1 (patch)
tree88d875a9723ce05f227389cab1e4862fe3ee0f18
parent8dd51650baf0861b0a73acb2c08bb944aa45bc61 (diff)
Input: trackpoint - handle sysfs errors
Also use kzalloc instead of kcalloc since we are allocating single object. Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/input/mouse/trackpoint.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
index ae5871a0e06..9ab5b5ea809 100644
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -293,6 +293,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char firmware_id;
unsigned char button_info;
+ int error;
if (trackpoint_start_protocol(psmouse, &firmware_id))
return -1;
@@ -305,7 +306,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
button_info = 0;
}
- psmouse->private = priv = kcalloc(1, sizeof(struct trackpoint_data), GFP_KERNEL);
+ psmouse->private = priv = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL);
if (!priv)
return -1;
@@ -318,7 +319,14 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
trackpoint_defaults(priv);
trackpoint_sync(psmouse);
- sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group);
+ error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group);
+ if (error) {
+ printk(KERN_ERR
+ "trackpoint.c: failed to create sysfs attributes, error: %d\n",
+ error);
+ kfree(priv);
+ return -1;
+ }
printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n",
firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f);