staging: comedi: ni_tio: make ni_gpct_device_destroy() NULL pointer safe
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 22 Mar 2016 18:10:40 +0000 (11:10 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
Modify the pointer check to make this function NULL pointer safe.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_tio.c

index b74e44ec521a494887b79bb6bb16f10c99558c5f..623fc6c7bff0554ac49da45ebf40a7d1bde4cb50 100644 (file)
@@ -1413,7 +1413,7 @@ EXPORT_SYMBOL_GPL(ni_gpct_device_construct);
 
 void ni_gpct_device_destroy(struct ni_gpct_device *counter_dev)
 {
-       if (!counter_dev->counters)
+       if (!counter_dev)
                return;
        kfree(counter_dev->counters);
        kfree(counter_dev);