Skip to content

Commit

Permalink
Staging: ipack/bridges/tpci200: fix kernel oops when uninstalling a d…
Browse files Browse the repository at this point in the history
…evice

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>
  • Loading branch information
Samuel Iglesias Gonsalvez authored and Greg Kroah-Hartman committed Jun 7, 2012
1 parent ca2d2bb commit 20cf700
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions drivers/staging/ipack/bridges/tpci200.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,23 +751,12 @@ static int tpci200_request_irq(struct ipack_device *dev, int vector,
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);
Expand Down

0 comments on commit 20cf700

Please sign in to comment.