From: akpm@osdl.org
To: davem@davemloft.net
Cc: jgarzik@pobox.com, netdev@oss.sgi.com, akpm@osdl.org,
takis@lumumba.luc.ac.be
Subject: [patch 2/3] ENI155P error handling fix
Date: Fri, 04 Mar 2005 04:37:17 -0800 [thread overview]
Message-ID: <200503041237.j24CbcGP026476@shell0.pdx.osdl.net> (raw)
From: Panagiotis Issaris <takis@lumumba.luc.ac.be>
In the ENI155P device driver in six possible failure cases the requested
irq is not being released.
In three of the above possible failure cases additionally there seems to
be a memory leak.
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
25-akpm/drivers/atm/eni.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff -puN drivers/atm/eni.c~eni155p-error-handling-fix drivers/atm/eni.c
--- 25/drivers/atm/eni.c~eni155p-error-handling-fix Wed Mar 2 15:16:35 2005
+++ 25-akpm/drivers/atm/eni.c Wed Mar 2 15:16:36 2005
@@ -59,7 +59,6 @@
* - doesn't support OAM cells
* - eni_put_free may hang if not putting memory fragments that _complete_
* 2^n block (never happens in real life, though)
- * - keeps IRQ even if initialization fails
*/
@@ -1802,22 +1801,22 @@ static int __devinit eni_start(struct at
if (request_irq(eni_dev->irq,&eni_int,SA_SHIRQ,DEV_LABEL,dev)) {
printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n",
dev->number,eni_dev->irq);
- return -EAGAIN;
+ error = -EAGAIN;
+ goto out;
}
- /* @@@ should release IRQ on error */
pci_set_master(eni_dev->pci_dev);
if ((error = pci_write_config_word(eni_dev->pci_dev,PCI_COMMAND,
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
(eni_dev->asic ? PCI_COMMAND_PARITY | PCI_COMMAND_SERR : 0)))) {
printk(KERN_ERR DEV_LABEL "(itf %d): can't enable memory+"
"master (0x%02x)\n",dev->number,error);
- return error;
+ goto free_irq;
}
if ((error = pci_write_config_byte(eni_dev->pci_dev,PCI_TONGA_CTRL,
END_SWAP_DMA))) {
printk(KERN_ERR DEV_LABEL "(itf %d): can't set endian swap "
"(0x%02x)\n",dev->number,error);
- return error;
+ goto free_irq;
}
/* determine addresses of internal tables */
eni_dev->vci = eni_dev->ram;
@@ -1839,7 +1838,8 @@ static int __devinit eni_start(struct at
if (!eni_dev->free_list) {
printk(KERN_ERR DEV_LABEL "(itf %d): couldn't get free page\n",
dev->number);
- return -ENOMEM;
+ error = -ENOMEM;
+ goto free_irq;
}
eni_dev->free_len = 0;
eni_put_free(eni_dev,buf,buffer_mem);
@@ -1855,17 +1855,26 @@ static int __devinit eni_start(struct at
*/
eni_out(0xffffffff,MID_IE);
error = start_tx(dev);
- if (error) return error;
+ if (error) goto free_list;
error = start_rx(dev);
- if (error) return error;
+ if (error) goto free_list;
error = dev->phy->start(dev);
- if (error) return error;
+ if (error) goto free_list;
eni_out(eni_in(MID_MC_S) | (1 << MID_INT_SEL_SHIFT) |
MID_TX_LOCK_MODE | MID_DMA_ENABLE | MID_TX_ENABLE | MID_RX_ENABLE,
MID_MC_S);
/* Tonga uses SBus INTReq1 */
(void) eni_in(MID_ISA); /* clear Midway interrupts */
return 0;
+
+free_list:
+ kfree(eni_dev->free_list);
+
+free_irq:
+ free_irq(eni_dev->irq, eni_dev);
+
+out:
+ return error;
}
_
reply other threads:[~2005-03-04 12:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200503041237.j24CbcGP026476@shell0.pdx.osdl.net \
--to=akpm@osdl.org \
--cc=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--cc=netdev@oss.sgi.com \
--cc=takis@lumumba.luc.ac.be \
/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).