From 68f780f1c5515adc256c3acd0353c774667e8a65 Mon Sep 17 00:00:00 2001 From: Andy Gospodarek Date: Mon, 28 Apr 2008 14:45:26 -0400 Subject: [PATCH] r8169: fix panic when using unlisted MAC When using the r8169 driver with an unlisted MAC, the system will panic in rtl8169_get_mac_version since it will try to access tp->pci_dev when it's unset. Moving the call to set pci_dev earlier in rtnl8169_init_one will resolve this and should not introduce any other problems. --- drivers/net/r8169.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index b1d1732..83597cd 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -1551,6 +1551,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) SET_NETDEV_DEV(dev, &pdev->dev); tp = netdev_priv(dev); tp->dev = dev; + tp->pci_dev = pdev; tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT); /* enable device (incl. PCI PM wakeup and hotplug setup) */ @@ -1721,7 +1722,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) #endif tp->intr_mask = 0xffff; - tp->pci_dev = pdev; tp->mmio_addr = ioaddr; tp->align = rtl_cfg_info[ent->driver_data].align; -- 1.5.2.1