diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2007-04-12 01:33:39 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2007-04-12 01:33:39 -0400 |
commit | 5014186de89708d0e9eed60526b698d5b786b707 (patch) | |
tree | 949ea6219db7779f635a34278325bd2d9617c657 /drivers/usb/input/aiptek.c | |
parent | db61a9124880a1d79b7b320d4b6bef717f23e485 (diff) |
Input: USB devices - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/usb/input/aiptek.c')
-rw-r--r-- | drivers/usb/input/aiptek.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c index f857935e615c..8c1ab1cbd233 100644 --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c | |||
@@ -1972,6 +1972,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1972 | AIPTEK_PROGRAMMABLE_DELAY_200, | 1972 | AIPTEK_PROGRAMMABLE_DELAY_200, |
1973 | AIPTEK_PROGRAMMABLE_DELAY_300 | 1973 | AIPTEK_PROGRAMMABLE_DELAY_300 |
1974 | }; | 1974 | }; |
1975 | int err = -ENOMEM; | ||
1975 | 1976 | ||
1976 | /* programmableDelay is where the command-line specified | 1977 | /* programmableDelay is where the command-line specified |
1977 | * delay is kept. We make it the first element of speeds[], | 1978 | * delay is kept. We make it the first element of speeds[], |
@@ -2133,7 +2134,9 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2133 | 2134 | ||
2134 | /* Register the tablet as an Input Device | 2135 | /* Register the tablet as an Input Device |
2135 | */ | 2136 | */ |
2136 | input_register_device(aiptek->inputdev); | 2137 | err = input_register_device(aiptek->inputdev); |
2138 | if (err) | ||
2139 | goto fail2; | ||
2137 | 2140 | ||
2138 | /* We now will look for the evdev device which is mapped to | 2141 | /* We now will look for the evdev device which is mapped to |
2139 | * the tablet. The partial name is kept in the link list of | 2142 | * the tablet. The partial name is kept in the link list of |
@@ -2165,23 +2168,13 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2165 | 2168 | ||
2166 | return 0; | 2169 | return 0; |
2167 | 2170 | ||
2168 | fail2: usb_buffer_free(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, | 2171 | fail2: usb_buffer_free(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, |
2169 | aiptek->data_dma); | 2172 | aiptek->data_dma); |
2170 | fail1: input_free_device(inputdev); | 2173 | fail1: input_free_device(inputdev); |
2171 | kfree(aiptek); | 2174 | kfree(aiptek); |
2172 | return -ENOMEM; | 2175 | return err; |
2173 | } | 2176 | } |
2174 | 2177 | ||
2175 | /* Forward declaration */ | ||
2176 | static void aiptek_disconnect(struct usb_interface *intf); | ||
2177 | |||
2178 | static struct usb_driver aiptek_driver = { | ||
2179 | .name = "aiptek", | ||
2180 | .probe = aiptek_probe, | ||
2181 | .disconnect = aiptek_disconnect, | ||
2182 | .id_table = aiptek_ids, | ||
2183 | }; | ||
2184 | |||
2185 | /*********************************************************************** | 2178 | /*********************************************************************** |
2186 | * Deal with tablet disconnecting from the system. | 2179 | * Deal with tablet disconnecting from the system. |
2187 | */ | 2180 | */ |
@@ -2206,6 +2199,13 @@ static void aiptek_disconnect(struct usb_interface *intf) | |||
2206 | } | 2199 | } |
2207 | } | 2200 | } |
2208 | 2201 | ||
2202 | static struct usb_driver aiptek_driver = { | ||
2203 | .name = "aiptek", | ||
2204 | .probe = aiptek_probe, | ||
2205 | .disconnect = aiptek_disconnect, | ||
2206 | .id_table = aiptek_ids, | ||
2207 | }; | ||
2208 | |||
2209 | static int __init aiptek_init(void) | 2209 | static int __init aiptek_init(void) |
2210 | { | 2210 | { |
2211 | int result = usb_register(&aiptek_driver); | 2211 | int result = usb_register(&aiptek_driver); |