aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/gameport/fm801-gp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-10-17 11:56:43 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-17 11:56:43 -0400
commit43f82216f0bd114599f4a221ae6924f3658a0c9a (patch)
tree89dbd85a0a1882ae38e6b61e360b365c018195fd /drivers/input/gameport/fm801-gp.c
parent20f85957667ccc53183b5ffac22213d75e317408 (diff)
parentb435fdcda126db42343b8055d04a0a27c229717b (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: fm801-gp - handle errors from pci_enable_device() Input: gameport core - handle errors returned by device_bind_driver() Input: serio core - handle errors returned by device_bind_driver() Lockdep: fix compile error in drivers/input/serio/serio.c Input: serio - add lockdep annotations Lockdep: add lockdep_set_class_and_subclass() and lockdep_set_subclass() Input: atkbd - supress "too many keys" error message Input: i8042 - supress ACK/NAKs when blinking during panic Input: add missing exports to fix modular build
Diffstat (limited to 'drivers/input/gameport/fm801-gp.c')
-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 90de5afe03c2..1dec00e20dbc 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
82{ 82{
83 struct fm801_gp *gp; 83 struct fm801_gp *gp;
84 struct gameport *port; 84 struct gameport *port;
85 int error;
85 86
86 gp = kzalloc(sizeof(struct fm801_gp), GFP_KERNEL); 87 gp = kzalloc(sizeof(struct fm801_gp), GFP_KERNEL);
87 port = gameport_allocate_port(); 88 port = gameport_allocate_port();
88 if (!gp || !port) { 89 if (!gp || !port) {
89 printk(KERN_ERR "fm801-gp: Memory allocation failed\n"); 90 printk(KERN_ERR "fm801-gp: Memory allocation failed\n");
90 kfree(gp); 91 error = -ENOMEM;
91 gameport_free_port(port); 92 goto err_out_free;
92 return -ENOMEM;
93 } 93 }
94 94
95 pci_enable_device(pci); 95 error = pci_enable_device(pci);
96 if (error)
97 goto err_out_free;
96 98
97 port->open = fm801_gp_open; 99 port->open = fm801_gp_open;
98#ifdef HAVE_COOKED 100#ifdef HAVE_COOKED
@@ -108,9 +110,8 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
108 if (!gp->res_port) { 110 if (!gp->res_port) {
109 printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n", 111 printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n",
110 port->io, port->io + 0x0f); 112 port->io, port->io + 0x0f);
111 gameport_free_port(port); 113 error = -EBUSY;
112 kfree(gp); 114 goto err_out_disable_dev;
113 return -EBUSY;
114 } 115 }
115 116
116 pci_set_drvdata(pci, gp); 117 pci_set_drvdata(pci, gp);
@@ -119,6 +120,13 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
119 gameport_register_port(port); 120 gameport_register_port(port);
120 121
121 return 0; 122 return 0;
123
124 err_out_disable_dev:
125 pci_disable_device(pci);
126 err_out_free:
127 gameport_free_port(port);
128 kfree(gp);
129 return error;
122} 130}
123 131
124static void __devexit fm801_gp_remove(struct pci_dev *pci) 132static void __devexit fm801_gp_remove(struct pci_dev *pci)