diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index c918745..c904931 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -527,7 +527,7 @@ int line6_write_data(struct usb_line6 *line6, int address, void *data, { struct usb_device *usbdev = line6->usbdev; int ret; - unsigned char status; + unsigned char *status; ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, @@ -540,26 +540,34 @@ int line6_write_data(struct usb_line6 *line6, int address, void *data, return ret; } + status = kmalloc(1, GFP_KERNEL); + if (status == NULL) + return -ENOMEM; + do { ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x0012, 0x0000, - &status, 1, LINE6_TIMEOUT * HZ); + status, 1, LINE6_TIMEOUT * HZ); if (ret < 0) { dev_err(line6->ifcdev, "receiving status failed (error %d)\n", ret); + kfree(status); return ret; } - } while (status == 0xff); + } while (*status == 0xff); - if (status != 0) { + if (*status != 0) { dev_err(line6->ifcdev, "write failed (error %d)\n", ret); + kfree(status); return -EINVAL; } + kfree(status); + return 0; } diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c index 6943715..ddc71a8 100644 --- a/drivers/staging/line6/toneport.c +++ b/drivers/staging/line6/toneport.c @@ -307,14 +307,20 @@ static void toneport_destruct(struct usb_interface *interface) */ static void toneport_setup(struct usb_line6_toneport *toneport) { - int ticks; + int *ticks; struct usb_line6 *line6 = &toneport->line6; struct usb_device *usbdev = line6->usbdev; u16 idProduct = le16_to_cpu(usbdev->descriptor.idProduct); + ticks = kmalloc(sizeof(int), GFP_KERNEL); + if (ticks == NULL) + return; + /* sync time on device with host: */ - ticks = (int)get_seconds(); - line6_write_data(line6, 0x80c6, &ticks, 4); + *ticks = (int)get_seconds(); + line6_write_data(line6, 0x80c6, ticks, sizeof(int)); + + kfree(ticks); /* enable device: */ toneport_send_cmd(usbdev, 0x0301, 0x0000);