Staging: ipack/bridges/tpci200: fix kernel oops when uninstalling a device
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Fri, 25 May 2012 08:03:05 +0000 (10:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Jun 2012 05:20:30 +0000 (14:20 +0900)
When uninstalling a device, the call to the ipack_bus_ops remove() frees
resources in the ipack device driver but without unregistering the device.

It generates a kernel oops when somebody wants to unregister the device.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ipack/bridges/tpci200.c

index e04cb8ade9e7b465648602f0f0ed5d5633b1cdf2..46127bca1af2345d9c83f216e5e6d6344643078b 100644 (file)
@@ -751,23 +751,12 @@ out:
        return res;
 }
 
-static void tpci200_slot_remove(struct tpci200_slot *slot)
-{
-       if ((slot->dev == NULL) ||
-           (slot->dev->driver == NULL) ||
-           (slot->dev->driver->ops == NULL) ||
-           (slot->dev->driver->ops->remove == NULL))
-               return;
-
-       slot->dev->driver->ops->remove(slot->dev);
-}
-
 static void tpci200_uninstall(struct tpci200_board *tpci200)
 {
        int i;
 
        for (i = 0; i < TPCI200_NB_SLOT; i++)
-               tpci200_slot_remove(&tpci200->slots[i]);
+               tpci200_slot_unregister(tpci200->slots[i].dev);
 
        tpci200_unregister(tpci200);
        kfree(tpci200->slots);