technology: Remove technology driver by pointer
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 28 Jan 2013 15:44:32 +0000 (17:44 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 30 Jan 2013 08:27:34 +0000 (10:27 +0200)
Compare the technology driver pointer to the driver being unregistered
as the function is supposed to remove only the given driver.

Also check if the driver has a remove function before calling it.

src/technology.c

index 6f03c69..7f2303c 100644 (file)
@@ -162,9 +162,11 @@ void connman_technology_driver_unregister(struct connman_technology_driver *driv
                if (technology->driver == NULL)
                        continue;
 
-               if (technology->type == driver->type) {
-                       technology->driver->remove(technology);
+               if (technology->driver == driver) {
+                       if (driver->remove != NULL)
+                               driver->remove(technology);
                        technology->driver = NULL;
+                       break;
                }
        }