summaryrefslogtreecommitdiffstats
path: root/drivers/input/gameport
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-10-12 01:06:53 -0400
committerDmitry Torokhov <dtor@insightbb.com>2006-10-12 01:06:53 -0400
commitb435fdcda126db42343b8055d04a0a27c229717b (patch)
treeb35685bd142ae8fb6e92f6a6468bf3f6676b75d0 /drivers/input/gameport
parent23de1510e2468ea349354889097e018d4e8770c5 (diff)
downloadop-kernel-dev-b435fdcda126db42343b8055d04a0a27c229717b.zip
op-kernel-dev-b435fdcda126db42343b8055d04a0a27c229717b.tar.gz
Input: fm801-gp - handle errors from pci_enable_device()
Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/gameport')
-rw-r--r--drivers/input/gameport/fm801-gp.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c
index 90de5af..1dec00e 100644
--- a/drivers/input/gameport/fm801-gp.c
+++ b/drivers/input/gameport/fm801-gp.c
@@ -82,17 +82,19 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
{
struct fm801_gp *gp;
struct gameport *port;
+ int error;
gp = kzalloc(sizeof(struct fm801_gp), GFP_KERNEL);
port = gameport_allocate_port();
if (!gp || !port) {
printk(KERN_ERR "fm801-gp: Memory allocation failed\n");
- kfree(gp);
- gameport_free_port(port);
- return -ENOMEM;
+ error = -ENOMEM;
+ goto err_out_free;
}
- pci_enable_device(pci);
+ error = pci_enable_device(pci);
+ if (error)
+ goto err_out_free;
port->open = fm801_gp_open;
#ifdef HAVE_COOKED
@@ -108,9 +110,8 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
if (!gp->res_port) {
printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n",
port->io, port->io + 0x0f);
- gameport_free_port(port);
- kfree(gp);
- return -EBUSY;
+ error = -EBUSY;
+ goto err_out_disable_dev;
}
pci_set_drvdata(pci, gp);
@@ -119,6 +120,13 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
gameport_register_port(port);
return 0;
+
+ err_out_disable_dev:
+ pci_disable_device(pci);
+ err_out_free:
+ gameport_free_port(port);
+ kfree(gp);
+ return error;
}
static void __devexit fm801_gp_remove(struct pci_dev *pci)
OpenPOWER on IntegriCloud