aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/gameport
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2012-01-24 13:34:24 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-24 19:00:34 -0500
commitfde25a9b63b9a3dc91365c394a426ebe64cfc2da (patch)
treeecc24bd2702cb7cb32cd4d22729541d5c79cee39 /drivers/input/gameport
parent2b31594a9523449b168946725689d039c80204de (diff)
Driver core: driver_find() drops reference before returning
As part of the removal of get_driver()/put_driver(), this patch (as1510) changes driver_find(); it now drops the reference it acquires before returning. The patch also adjusts all the callers of driver_find() to remove the now unnecessary calls to put_driver(). In addition, the patch adds a warning to driver_find(): Callers must make sure the driver they are searching for does not get unloaded while they are using it. This has always been the case; driver_find() has never prevented a driver from being unregistered or unloaded. Hence the patch will not introduce any new bugs. The existing callers all seem to be okay in this respect, however I don't understand the video drivers well enough to be certain about them. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: Dmitry Torokhov <dmitry.torokhov@gmail.com> CC: Kyungmin Park <kyungmin.park@samsung.com> CC: Andy Walls <awalls@md.metrocast.net> CC: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/input/gameport')
-rw-r--r--drivers/input/gameport/gameport.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index c351aa421f8f..da739d9d1905 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -449,7 +449,6 @@ static ssize_t gameport_rebind_driver(struct device *dev, struct device_attribut
449 } else if ((drv = driver_find(buf, &gameport_bus)) != NULL) { 449 } else if ((drv = driver_find(buf, &gameport_bus)) != NULL) {
450 gameport_disconnect_port(gameport); 450 gameport_disconnect_port(gameport);
451 error = gameport_bind_driver(gameport, to_gameport_driver(drv)); 451 error = gameport_bind_driver(gameport, to_gameport_driver(drv));
452 put_driver(drv);
453 } else { 452 } else {
454 error = -EINVAL; 453 error = -EINVAL;
455 } 454 }