diff options
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r-- | drivers/input/mouse/appletouch.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index 454b96112f03..e0140fdc02a5 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c | |||
@@ -255,15 +255,22 @@ MODULE_PARM_DESC(debug, "Activate debugging output"); | |||
255 | */ | 255 | */ |
256 | static int atp_geyser_init(struct usb_device *udev) | 256 | static int atp_geyser_init(struct usb_device *udev) |
257 | { | 257 | { |
258 | char data[8]; | 258 | char *data; |
259 | int size; | 259 | int size; |
260 | int i; | 260 | int i; |
261 | int ret; | ||
262 | |||
263 | data = kmalloc(8, GFP_KERNEL); | ||
264 | if (!data) { | ||
265 | err("Out of memory"); | ||
266 | return -ENOMEM; | ||
267 | } | ||
261 | 268 | ||
262 | size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 269 | size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
263 | ATP_GEYSER_MODE_READ_REQUEST_ID, | 270 | ATP_GEYSER_MODE_READ_REQUEST_ID, |
264 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | 271 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, |
265 | ATP_GEYSER_MODE_REQUEST_VALUE, | 272 | ATP_GEYSER_MODE_REQUEST_VALUE, |
266 | ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000); | 273 | ATP_GEYSER_MODE_REQUEST_INDEX, data, 8, 5000); |
267 | 274 | ||
268 | if (size != 8) { | 275 | if (size != 8) { |
269 | dprintk("atp_geyser_init: read error\n"); | 276 | dprintk("atp_geyser_init: read error\n"); |
@@ -271,7 +278,8 @@ static int atp_geyser_init(struct usb_device *udev) | |||
271 | dprintk("appletouch[%d]: %d\n", i, data[i]); | 278 | dprintk("appletouch[%d]: %d\n", i, data[i]); |
272 | 279 | ||
273 | err("Failed to read mode from device."); | 280 | err("Failed to read mode from device."); |
274 | return -EIO; | 281 | ret = -EIO; |
282 | goto out_free; | ||
275 | } | 283 | } |
276 | 284 | ||
277 | /* Apply the mode switch */ | 285 | /* Apply the mode switch */ |
@@ -281,7 +289,7 @@ static int atp_geyser_init(struct usb_device *udev) | |||
281 | ATP_GEYSER_MODE_WRITE_REQUEST_ID, | 289 | ATP_GEYSER_MODE_WRITE_REQUEST_ID, |
282 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | 290 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, |
283 | ATP_GEYSER_MODE_REQUEST_VALUE, | 291 | ATP_GEYSER_MODE_REQUEST_VALUE, |
284 | ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000); | 292 | ATP_GEYSER_MODE_REQUEST_INDEX, data, 8, 5000); |
285 | 293 | ||
286 | if (size != 8) { | 294 | if (size != 8) { |
287 | dprintk("atp_geyser_init: write error\n"); | 295 | dprintk("atp_geyser_init: write error\n"); |
@@ -289,9 +297,13 @@ static int atp_geyser_init(struct usb_device *udev) | |||
289 | dprintk("appletouch[%d]: %d\n", i, data[i]); | 297 | dprintk("appletouch[%d]: %d\n", i, data[i]); |
290 | 298 | ||
291 | err("Failed to request geyser raw mode"); | 299 | err("Failed to request geyser raw mode"); |
292 | return -EIO; | 300 | ret = -EIO; |
301 | goto out_free; | ||
293 | } | 302 | } |
294 | return 0; | 303 | ret = 0; |
304 | out_free: | ||
305 | kfree(data); | ||
306 | return ret; | ||
295 | } | 307 | } |
296 | 308 | ||
297 | /* | 309 | /* |