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>
This commit is contained in:
Samuel Iglesias Gonsalvez 2012-05-23 15:54:44 +02:00 committed by Greg Kroah-Hartman
parent 6ad0c486a4
commit 786d986ea2

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