diff options
-rw-r--r-- | drivers/parport/parport_pc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 2951b9084bfd2..c5774e7855d03 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -2976,10 +2976,12 @@ static void __devexit parport_pc_pci_remove(struct pci_dev *dev) pci_set_drvdata(dev, NULL); - for (i = data->num - 1; i >= 0; i--) - parport_pc_unregister_port(data->ports[i]); + if (data) { + for (i = data->num - 1; i >= 0; i--) + parport_pc_unregister_port(data->ports[i]); - kfree(data); + kfree(data); + } } static struct pci_driver parport_pc_pci_driver = { |