input drivers: handle sysfs errors
Signed-off-by Jeff Garzik <[email protected]>
---
drivers/input/gameport/fm801-gp.c | 29 ++++++++++++++++------- drivers/input/mouse/logips2pp.c | 5 ++-- drivers/input/touchscreen/ads7846.c | 45 ++++++++++++++++++++++++------------ 3 files changed, 54 insertions(+), 25 deletions(-)
drivers/input/gameport/fm801-gp.c +21 -8
@@ -82,17 +82,22 @@ static int __devinit fm801_gp_probe(stru {struct fm801_gp *gp;struct gameport *port; +int rc = -ENOMEM ; gp =kzalloc (sizeof (struct fm801_gp ),GFP_KERNEL ); +if (!gp) { +printk (KERN_ERR "fm801-gp: Memory allocation failed\n" ); + goto err_out; + } port =gameport_allocate_port (); -if (!gp || !port) { +if (!port) {printk (KERN_ERR "fm801-gp: Memory allocation failed\n" ); -kfree (gp); -gameport_free_port (port); -return -ENOMEM ; + goto err_out_gp; } -pci_enable_device (pci); + rc =pci_enable_device (pci); +if (rc) + goto err_out_port; port->open = fm801_gp_open;#ifdef HAVE_COOKED
@@ -108,9 +113,8 @@ #endifif (!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 ; + rc = -EBUSY ; + goto err_out_enabledev; }pci_set_drvdata (pci, gp);
@@ -119,6 +123,15 @@ #endifgameport_register_port (port);return 0 ; + +err_out_enabledev: +pci_disable_device (pci); +err_out_port: +gameport_free_port (port); +err_out_gp: +kfree (gp); +err_out: +return rc; } static void __devexit fm801_gp_remove(struct pci_dev *pci)
drivers/input/mouse/logips2pp.c +3 -2
@@ -393,8 +393,9 @@ int ps2pp_init(struct psmouse *psmouse, psmouse->set_resolution = ps2pp_set_resolution; psmouse->disconnect = ps2pp_disconnect; -device_create_file (&psmouse->ps2dev.serio->dev, - &psmouse_attr_smartscroll.dattr); +if (device_create_file (&psmouse->ps2dev.serio->dev, + &psmouse_attr_smartscroll.dattr)) +return -1 ; } }
drivers/input/touchscreen/ads7846.c +30 -15
64 lines not on this page · raw message