Messages in this thread Patch in this message | | | Date | Thu, 6 Jun 2002 08:14:09 -0700 (PDT) | From | Patrick Mochel <> | Subject | Re: device model update 2/2 |
| |
On Thu, 6 Jun 2002, Amici Alessandro wrote:
> > hi, > > + lock_device(dev); > + dev->driver = NULL; > + unlock_device(dev); > + > + /* detach from driver */ > + if (dev->driver->remove) > + dev->driver->remove(dev); > + put_driver(dev->driver); > > you might want to exchange these two blocks :)
D'oh. bk://ldm.bkbits.net/linux-2.5 is being updated now. Incremental patch below.
-pat
ChangeSet@1.456, 2002-06-06 08:10:56-07:00, mochel@osdl.org Don't reference driver after you set pointer to NULL in device_detach
drivers/base/core.c | 8 ++++---- 1 files changed, 4 insertions, 4 deletions
diff -Nru a/drivers/base/core.c b/drivers/base/core.c --- a/drivers/base/core.c Thu Jun 6 08:13:54 2002 +++ b/drivers/base/core.c Thu Jun 6 08:13:54 2002 @@ -103,14 +103,14 @@ list_del_init(&dev->driver_list); write_unlock(&dev->driver->lock); - lock_device(dev); - dev->driver = NULL; - unlock_device(dev); - /* detach from driver */ if (dev->driver->remove) dev->driver->remove(dev); put_driver(dev->driver); + + lock_device(dev); + dev->driver = NULL; + unlock_device(dev); } } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |