Browse Source

Staging: ipack/bridges/tpci200: check if the remove function is available

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>
Samuel Iglesias Gonsalvez 13 years ago
parent
commit
786d986ea2
1 changed files with 2 additions and 0 deletions
  1. 2 0
      drivers/staging/ipack/bridges/tpci200.c

+ 2 - 0
drivers/staging/ipack/bridges/tpci200.c

@@ -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;