aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joystick/magellan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/joystick/magellan.c')
-rw-r--r--drivers/input/joystick/magellan.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c
index e3d19444ba2e..d512b0a0282e 100644
--- a/drivers/input/joystick/magellan.c
+++ b/drivers/input/joystick/magellan.c
@@ -157,7 +157,7 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
157 magellan = kzalloc(sizeof(struct magellan), GFP_KERNEL); 157 magellan = kzalloc(sizeof(struct magellan), GFP_KERNEL);
158 input_dev = input_allocate_device(); 158 input_dev = input_allocate_device();
159 if (!magellan || !input_dev) 159 if (!magellan || !input_dev)
160 goto fail; 160 goto fail1;
161 161
162 magellan->dev = input_dev; 162 magellan->dev = input_dev;
163 snprintf(magellan->phys, sizeof(magellan->phys), "%s/input0", serio->phys); 163 snprintf(magellan->phys, sizeof(magellan->phys), "%s/input0", serio->phys);
@@ -183,13 +183,17 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
183 183
184 err = serio_open(serio, drv); 184 err = serio_open(serio, drv);
185 if (err) 185 if (err)
186 goto fail; 186 goto fail2;
187
188 err = input_register_device(magellan->dev);
189 if (err)
190 goto fail3;
187 191
188 input_register_device(magellan->dev);
189 return 0; 192 return 0;
190 193
191 fail: serio_set_drvdata(serio, NULL); 194 fail3: serio_close(serio);
192 input_free_device(input_dev); 195 fail2: serio_set_drvdata(serio, NULL);
196 fail1: input_free_device(input_dev);
193 kfree(magellan); 197 kfree(magellan);
194 return err; 198 return err;
195} 199}