From: davej@codemonkey.org.uk
To: jgarzik@pobox.com
Cc: linux-kernel@vger.kernel.org
Subject: xircom init_etherdev conversion.
Date: Mon, 24 Mar 2003 16:41:51 +0000 [thread overview]
Message-ID: <200303241642.h2OGg335008252@deviant.impure.org.uk> (raw)
- Also cleans up some exit paths.
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/tulip/xircom_cb.c linux-2.5/drivers/net/tulip/xircom_cb.c
--- bk-linus/drivers/net/tulip/xircom_cb.c 2003-03-08 09:57:19.000000000 +0000
+++ linux-2.5/drivers/net/tulip/xircom_cb.c 2003-02-25 14:07:53.000000000 +0000
@@ -249,32 +249,24 @@ static int __devinit xircom_probe(struct
This way, we can fail gracefully if not enough memory
is available.
*/
- private = kmalloc(sizeof(*private),GFP_KERNEL);
- memset(private, 0, sizeof(struct xircom_private));
+ if ((dev = init_etherdev(dev, sizeof(struct xircom_private))) == NULL) {
+ printk(KERN_ERR "xircom_probe: failed to allocate etherdev\n");
+ goto device_fail;
+ }
+ private = dev->priv;
/* Allocate the send/receive buffers */
private->rx_buffer = pci_alloc_consistent(pdev,8192,&private->rx_dma_handle);
-
if (private->rx_buffer == NULL) {
printk(KERN_ERR "xircom_probe: no memory for rx buffer \n");
- kfree(private);
- return -ENODEV;
+ goto rx_buf_fail;
}
private->tx_buffer = pci_alloc_consistent(pdev,8192,&private->tx_dma_handle);
if (private->tx_buffer == NULL) {
printk(KERN_ERR "xircom_probe: no memory for tx buffer \n");
- kfree(private->rx_buffer);
- kfree(private);
- return -ENODEV;
- }
- dev = init_etherdev(dev, 0);
- if (dev == NULL) {
- printk(KERN_ERR "xircom_probe: failed to allocate etherdev\n");
- kfree(private->rx_buffer);
- kfree(private->tx_buffer);
- kfree(private);
- return -ENODEV;
+ goto tx_buf_fail;
}
+
SET_MODULE_OWNER(dev);
printk(KERN_INFO "%s: Xircom cardbus revision %i at irq %i \n", dev->name, chip_rev, pdev->irq);
@@ -304,14 +296,21 @@ static int __devinit xircom_probe(struct
transceiver_voodoo(private);
spin_lock_irqsave(&private->lock,flags);
- activate_transmitter(private);
- activate_receiver(private);
+ activate_transmitter(private);
+ activate_receiver(private);
spin_unlock_irqrestore(&private->lock,flags);
trigger_receive(private);
leave("xircom_probe");
return 0;
+
+tx_buf_fail:
+ kfree(private->rx_buffer);
+rx_buf_fail:
+ kfree(dev);
+device_fail:
+ return -ENODEV;
}
next reply other threads:[~2003-03-24 16:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-24 16:41 davej [this message]
2003-03-29 5:02 ` Jeff Garzik
2003-03-29 11:02 ` Dave Jones
2003-03-29 13:49 ` 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=200303241642.h2OGg335008252@deviant.impure.org.uk \
--to=davej@codemonkey.org.uk \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®