diff options
Diffstat (limited to 'drivers/usb/serial/opticon.c')
| -rw-r--r-- | drivers/usb/serial/opticon.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index 41b1647306eb..6aba731d4864 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
| @@ -155,7 +155,11 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, | |||
| 155 | { | 155 | { |
| 156 | struct usb_serial *serial = port->serial; | 156 | struct usb_serial *serial = port->serial; |
| 157 | int retval; | 157 | int retval; |
| 158 | u8 buffer[2]; | 158 | u8 *buffer; |
| 159 | |||
| 160 | buffer = kzalloc(1, GFP_KERNEL); | ||
| 161 | if (!buffer) | ||
| 162 | return -ENOMEM; | ||
| 159 | 163 | ||
| 160 | buffer[0] = val; | 164 | buffer[0] = val; |
| 161 | /* Send the message to the vendor control endpoint | 165 | /* Send the message to the vendor control endpoint |
| @@ -164,6 +168,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, | |||
| 164 | requesttype, | 168 | requesttype, |
| 165 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, | 169 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, |
| 166 | 0, 0, buffer, 1, 0); | 170 | 0, 0, buffer, 1, 0); |
| 171 | kfree(buffer); | ||
| 167 | 172 | ||
| 168 | return retval; | 173 | return retval; |
| 169 | } | 174 | } |
| @@ -281,7 +286,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
| 281 | if (!dr) { | 286 | if (!dr) { |
| 282 | dev_err(&port->dev, "out of memory\n"); | 287 | dev_err(&port->dev, "out of memory\n"); |
| 283 | count = -ENOMEM; | 288 | count = -ENOMEM; |
| 284 | goto error; | 289 | goto error_no_dr; |
| 285 | } | 290 | } |
| 286 | 291 | ||
| 287 | dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT; | 292 | dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT; |
| @@ -311,6 +316,8 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
| 311 | 316 | ||
| 312 | return count; | 317 | return count; |
| 313 | error: | 318 | error: |
| 319 | kfree(dr); | ||
| 320 | error_no_dr: | ||
| 314 | usb_free_urb(urb); | 321 | usb_free_urb(urb); |
| 315 | error_no_urb: | 322 | error_no_urb: |
| 316 | kfree(buffer); | 323 | kfree(buffer); |
