aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard/newtonkbd.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:39:56 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:39:56 -0500
commit2b03b60e6b8635fffdd15d5d24943950f2bbf96e (patch)
tree17f0354b7edb08920a89e663ef724c84518c49fa /drivers/input/keyboard/newtonkbd.c
parent41ad5fbabda0c3930136bb40cfc7a0c23013365f (diff)
Input: keyboards - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard/newtonkbd.c')
-rw-r--r--drivers/input/keyboard/newtonkbd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/input/keyboard/newtonkbd.c b/drivers/input/keyboard/newtonkbd.c
index 9282e4e082bd..33e813948d6f 100644
--- a/drivers/input/keyboard/newtonkbd.c
+++ b/drivers/input/keyboard/newtonkbd.c
@@ -91,7 +91,7 @@ static int nkbd_connect(struct serio *serio, struct serio_driver *drv)
91 nkbd = kzalloc(sizeof(struct nkbd), GFP_KERNEL); 91 nkbd = kzalloc(sizeof(struct nkbd), GFP_KERNEL);
92 input_dev = input_allocate_device(); 92 input_dev = input_allocate_device();
93 if (!nkbd || !input_dev) 93 if (!nkbd || !input_dev)
94 goto fail; 94 goto fail1;
95 95
96 nkbd->serio = serio; 96 nkbd->serio = serio;
97 nkbd->dev = input_dev; 97 nkbd->dev = input_dev;
@@ -119,13 +119,17 @@ static int nkbd_connect(struct serio *serio, struct serio_driver *drv)
119 119
120 err = serio_open(serio, drv); 120 err = serio_open(serio, drv);
121 if (err) 121 if (err)
122 goto fail; 122 goto fail2;
123
124 err = input_register_device(nkbd->dev);
125 if (err)
126 goto fail3;
123 127
124 input_register_device(nkbd->dev);
125 return 0; 128 return 0;
126 129
127 fail: serio_set_drvdata(serio, NULL); 130 fail3: serio_close(serio);
128 input_free_device(input_dev); 131 fail2: serio_set_drvdata(serio, NULL);
132 fail1: input_free_device(input_dev);
129 kfree(nkbd); 133 kfree(nkbd);
130 return err; 134 return err;
131} 135}