From: Stephen Hemminger <shemminger@osdl.org>
To: Ganesh Venkatesan <Ganesh.Venkatesan@intel.com>,
"Feldman, Scott" <scott.feldman@intel.com>,
Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@oss.sgi.com
Subject: [PATCH] ixgb fixes
Date: Thu, 15 Jan 2004 14:02:48 -0800 [thread overview]
Message-ID: <20040115140248.170a3ee3.shemminger@osdl.org> (raw)
Ixgb driver in 2.6.1 (possibly 2.4) has several problems:
* register_netdev error never handled
* returns -ENOMEM for errors like bad eeprom etc
* keeps copy of device name in the private data structure
which is never used, and would be wrong anyway if
the device was renamed.
diff -Nru a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
--- a/drivers/net/ixgb/ixgb.h Thu Jan 15 13:58:48 2004
+++ b/drivers/net/ixgb/ixgb.h Thu Jan 15 13:58:48 2004
@@ -179,7 +179,6 @@
struct ixgb_hw hw;
struct ixgb_hw_stats stats;
u32 pci_state[16];
- char ifname[IFNAMSIZ];
};
#endif /* _IXGB_H_ */
diff -Nru a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
--- a/drivers/net/ixgb/ixgb_main.c Thu Jan 15 13:58:48 2004
+++ b/drivers/net/ixgb/ixgb_main.c Thu Jan 15 13:58:48 2004
@@ -299,28 +299,28 @@
unsigned long mmio_start;
int mmio_len;
int pci_using_dac;
- int i;
+ int i, err;
IXGB_DBG("ixgb_probe\n");
- if ((i = pci_enable_device(pdev))) {
+ if ((err = pci_enable_device(pdev))) {
IXGB_ERR("pci_enable_device failed\n");
- return i;
+ goto err_out;
}
- if (!(i = pci_set_dma_mask(pdev, PCI_DMA_64BIT))) {
+ if (!(err = pci_set_dma_mask(pdev, PCI_DMA_64BIT))) {
pci_using_dac = 1;
} else {
- if ((i = pci_set_dma_mask(pdev, PCI_DMA_32BIT))) {
+ if ((err = pci_set_dma_mask(pdev, PCI_DMA_32BIT))) {
IXGB_ERR("No usable DMA configuration, aborting\n");
- return i;
+ goto err_out;
}
pci_using_dac = 0;
}
- if ((i = pci_request_regions(pdev, ixgb_driver_name))) {
+ if ((err = pci_request_regions(pdev, ixgb_driver_name))) {
IXGB_ERR("Failed to reserve PCI I/O and Memory resources.\n");
- return i;
+ goto err_out;
}
pci_set_master(pdev);
@@ -329,7 +329,8 @@
netdev = alloc_etherdev(sizeof (struct ixgb_adapter));
if (!netdev) {
IXGB_ERR("Unable to allocate net_device struct\n");
- goto err_alloc_etherdev;
+ err = -ENOMEM;
+ goto err_out;
}
SET_MODULE_OWNER(netdev);
@@ -345,8 +346,10 @@
mmio_len = pci_resource_len(pdev, BAR_0);
adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
- if (!adapter->hw.hw_addr)
+ if (!adapter->hw.hw_addr) {
+ err = -EIO;
goto err_ioremap;
+ }
for (i = BAR_1; i <= BAR_5; i++) {
if (pci_resource_len(pdev, i) == 0)
@@ -404,6 +407,7 @@
if (!ixgb_validate_eeprom_checksum(&adapter->hw)) {
IXGB_DBG("Invalid EEPROM checksum.\n");
+ err = -EIO;
goto err_eeprom;
}
@@ -411,6 +415,7 @@
if (!is_valid_ether_addr(netdev->dev_addr)) {
IXGB_DBG("Invalid MAC address in EEPROM.\n");
+ err = -EIO;
goto err_eeprom;
}
@@ -424,9 +429,9 @@
INIT_WORK(&adapter->tx_timeout_task,
(void (*)(void *)) ixgb_tx_timeout_task, netdev);
- register_netdev(netdev);
- memcpy(adapter->ifname, netdev->name, IFNAMSIZ);
- adapter->ifname[IFNAMSIZ - 1] = 0;
+ err = register_netdev(netdev);
+ if (err)
+ goto err_eeprom;
/* we're going to reset, so assume we have no link for now */
@@ -447,8 +452,8 @@
err_ioremap:
pci_release_regions(pdev);
kfree(netdev);
- err_alloc_etherdev:
- return -ENOMEM;
+ err_out:
+ return err;
}
/**
next reply other threads:[~2004-01-15 22:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-15 22:02 Stephen Hemminger [this message]
2004-02-26 5:54 ` [PATCH] ixgb fixes Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040115140248.170a3ee3.shemminger@osdl.org \
--to=shemminger@osdl.org \
--cc=Ganesh.Venkatesan@intel.com \
--cc=jgarzik@pobox.com \
--cc=netdev@oss.sgi.com \
--cc=scott.feldman@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).