diff options
-rw-r--r-- | drivers/input/gameport/gameport.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 3f47ae55c6f3..a0af97efe6ac 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -191,6 +191,8 @@ static void gameport_run_poll_handler(unsigned long d) | |||
191 | 191 | ||
192 | static void gameport_bind_driver(struct gameport *gameport, struct gameport_driver *drv) | 192 | static void gameport_bind_driver(struct gameport *gameport, struct gameport_driver *drv) |
193 | { | 193 | { |
194 | int error; | ||
195 | |||
194 | down_write(&gameport_bus.subsys.rwsem); | 196 | down_write(&gameport_bus.subsys.rwsem); |
195 | 197 | ||
196 | gameport->dev.driver = &drv->driver; | 198 | gameport->dev.driver = &drv->driver; |
@@ -198,8 +200,20 @@ static void gameport_bind_driver(struct gameport *gameport, struct gameport_driv | |||
198 | gameport->dev.driver = NULL; | 200 | gameport->dev.driver = NULL; |
199 | goto out; | 201 | goto out; |
200 | } | 202 | } |
201 | device_bind_driver(&gameport->dev); | 203 | |
202 | out: | 204 | error = device_bind_driver(&gameport->dev); |
205 | if (error) { | ||
206 | printk(KERN_WARNING | ||
207 | "gameport: device_bind_driver() failed " | ||
208 | "for %s (%s) and %s, error: %d\n", | ||
209 | gameport->phys, gameport->name, | ||
210 | drv->description, error); | ||
211 | drv->disconnect(gameport); | ||
212 | gameport->dev.driver = NULL; | ||
213 | goto out; | ||
214 | } | ||
215 | |||
216 | out: | ||
203 | up_write(&gameport_bus.subsys.rwsem); | 217 | up_write(&gameport_bus.subsys.rwsem); |
204 | } | 218 | } |
205 | 219 | ||