@@ -1166,21 +1166,21 @@ static void pch_spi_remove(struct pci_dev *pdev)
spin_unlock(&board_dat->data[i]->lock);
}
- /* Free resources allocated for PCH SPI */
- pch_spi_free_resources(board_dat);
-
/* Unregister SPI master */
for (i = 0; i < board_dat->num; i++)
spi_unregister_master(board_dat->data[i]->master);
- /* free memory for private data */
- kfree(board_dat);
+ /* Free resources allocated for PCH SPI */
+ pch_spi_free_resources(board_dat);
pci_set_drvdata(pdev, NULL);
/* disable PCI device */
pci_disable_device(pdev);
+ /* free memory for private data */
+ kfree(board_dat);
+
dev_dbg(&pdev->dev, "%s invoked pci_disable_device\n", __func__);
}