struct pxa2xx_spi_controller *pdata;
        struct ssp_device *ssp;
        struct resource *res;
+       struct device *parent = pdev->dev.parent;
+       struct pci_dev *pcidev = dev_is_pci(parent) ? to_pci_dev(parent) : NULL;
        const struct pci_device_id *pcidev_id = NULL;
        enum pxa_ssp_type type;
        const void *match;
 
-       if (dev_is_pci(pdev->dev.parent))
-               pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match,
-                                        to_pci_dev(pdev->dev.parent));
+       if (pcidev)
+               pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match, pcidev);
 
        match = device_get_match_data(&pdev->dev);
        if (match)
 
 #ifdef CONFIG_PCI
        if (pcidev_id) {
-               pdata->tx_param = pdev->dev.parent;
-               pdata->rx_param = pdev->dev.parent;
+               pdata->tx_param = parent;
+               pdata->rx_param = parent;
                pdata->dma_filter = pxa2xx_spi_idma_filter;
        }
 #endif