lkml.org 
[lkml]   [2006]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[GIT PATCH 15/18] tmdc: handle errors from input_register_device()
Input: tmdc - handle errors from input_register_device()

Also set .owner in driver structure so we'll have a link between
module and driver in sysfs.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

drivers/input/joystick/tmdc.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)

Index: work/drivers/input/joystick/tmdc.c
===================================================================
--- work.orig/drivers/input/joystick/tmdc.c
+++ work/drivers/input/joystick/tmdc.c
@@ -284,13 +284,13 @@ static int tmdc_setup_port(struct tmdc *
struct tmdc_port *port;
struct input_dev *input_dev;
int i, j, b = 0;
+ int err;

tmdc->port[idx] = port = kzalloc(sizeof (struct tmdc_port), GFP_KERNEL);
input_dev = input_allocate_device();
if (!port || !input_dev) {
- kfree(port);
- input_free_device(input_dev);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto fail;
}

port->mode = data[TMDC_BYTE_ID];
@@ -347,9 +347,15 @@ static int tmdc_setup_port(struct tmdc *
b += port->btnc[i];
}

- input_register_device(port->dev);
+ err = input_register_device(port->dev);
+ if (err)
+ goto fail;

return 0;
+
+ fail: input_free_device(input_dev);
+ kfree(port);
+ return err;
}

/*
@@ -424,6 +430,7 @@ static void tmdc_disconnect(struct gamep
static struct gameport_driver tmdc_drv = {
.driver = {
.name = "tmdc",
+ .owner = THIS_MODULE,
},
.description = DRIVER_DESC,
.connect = tmdc_connect,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-02-01 06:16    [W:0.090 / U:1.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site