return edev ? edev->pdev : NULL;
 }
 
+static inline struct eeh_pe *eeh_dev_to_pe(struct eeh_dev* edev)
+{
+       return edev ? edev->pe : NULL;
+}
+
 /* Return values from eeh_ops::next_error */
 enum {
        EEH_NEXT_ERR_NONE = 0,
 
        }
        dn = eeh_dev_to_of_node(edev);
        dev = eeh_dev_to_pci_dev(edev);
-       pe = edev->pe;
+       pe = eeh_dev_to_pe(edev);
 
        /* Access to IO BARs might get this far and still not want checking. */
        if (!pe) {
 int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state)
 {
        struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
-       struct eeh_pe *pe = edev->pe;
+       struct eeh_pe *pe = eeh_dev_to_pe(edev);
 
        if (!pe) {
                pr_err("%s: No PE found on PCI device %s\n",
 
        }
 
        /* Remove the EEH device */
-       pe = edev->pe;
+       pe = eeh_dev_to_pe(edev);
        edev->pe = NULL;
        list_del(&edev->list);