Staging: ipack/bridges/tpci200: check if the remove function is available
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Wed, 23 May 2012 13:54:44 +0000 (15:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Jun 2012 05:14:08 +0000 (14:14 +0900)
To avoid a dereference of a NULL pointer, the availability of the function is
checked before its use.

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 0c2a50a1ec002d603bdb54228c576f12f6134194..ee26d9a7e370f776b19ad5b02ede89ccafc4b59d 100644 (file)
@@ -764,6 +764,8 @@ out:
 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;