aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/misc/ftdi-elan.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index 0eb26a26115b..37d1f4e90d5a 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -1186,11 +1186,8 @@ static ssize_t ftdi_elan_write(struct file *file,
1186 int retval = 0; 1186 int retval = 0;
1187 struct urb *urb; 1187 struct urb *urb;
1188 char *buf; 1188 char *buf;
1189 char data[30 *3 + 4]; 1189 struct usb_ftdi *ftdi = file->private_data;
1190 char *d = data; 1190
1191 const char __user *s = user_buffer;
1192 int m = (sizeof(data) - 1) / 3;
1193 struct usb_ftdi *ftdi = (struct usb_ftdi *)file->private_data;
1194 if (ftdi->disconnected > 0) { 1191 if (ftdi->disconnected > 0) {
1195 return -ENODEV; 1192 return -ENODEV;
1196 } 1193 }
@@ -1220,27 +1217,18 @@ static ssize_t ftdi_elan_write(struct file *file,
1220 if (retval) { 1217 if (retval) {
1221 dev_err(&ftdi->udev->dev, "failed submitting write urb, error %" 1218 dev_err(&ftdi->udev->dev, "failed submitting write urb, error %"
1222 "d\n", retval); 1219 "d\n", retval);
1223 goto error_4; 1220 goto error_3;
1224 } 1221 }
1225 usb_free_urb(urb); 1222 usb_free_urb(urb);
1226 exit:; 1223
1227 if (count > m) { 1224exit:
1228 int I = m - 1;
1229 while (I-- > 0) {
1230 d += sprintf(d, " %02X", 0x000000FF & *s++);
1231 }
1232 d += sprintf(d, " ..");
1233 } else {
1234 int I = count;
1235 while (I-- > 0) {
1236 d += sprintf(d, " %02X", 0x000000FF & *s++);
1237 }
1238 }
1239 return count; 1225 return count;
1240 error_4: error_3:usb_buffer_free(ftdi->udev, count, buf, 1226error_3:
1241 urb->transfer_dma); 1227 usb_buffer_free(ftdi->udev, count, buf, urb->transfer_dma);
1242 error_2:usb_free_urb(urb); 1228error_2:
1243 error_1:return retval; 1229 usb_free_urb(urb);
1230error_1:
1231 return retval;
1244} 1232}
1245 1233
1246static struct file_operations ftdi_elan_fops = { 1234static struct file_operations ftdi_elan_fops = {