]> git.neil.brown.name Git - history.git/commitdiff
driver model: keep reference to device during device_add().
authorPatrick Mochel <mochel@osdl.org>
Wed, 20 Nov 2002 11:56:53 +0000 (05:56 -0600)
committerPatrick Mochel <mochel@osdl.org>
Wed, 20 Nov 2002 11:56:53 +0000 (05:56 -0600)
drivers/base/core.c

index e591edef8e1dd75cf06c343d18bd8afc9231aca4..6425fc8e0634a43f1c176167fc818561fe56f279 100644 (file)
@@ -168,7 +168,8 @@ int device_add(struct device *dev)
 {
        struct device * parent;
        int error;
-       
+
+       dev = get_device(dev);
        if (!dev || !strlen(dev->bus_id))
                return -EINVAL;
 
@@ -208,6 +209,7 @@ int device_add(struct device *dev)
  register_done:
        if (error && parent)
                put_device(parent);
+       put_device(dev);
        return error;
 }