aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/kobil_sct.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/kobil_sct.c')
-rw-r--r--drivers/usb/serial/kobil_sct.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 237289920f03..0683b51f0932 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -110,6 +110,7 @@ static struct usb_serial_driver kobil_device = {
110 .name = "kobil", 110 .name = "kobil",
111 }, 111 },
112 .description = "KOBIL USB smart card terminal", 112 .description = "KOBIL USB smart card terminal",
113 .usb_driver = &kobil_driver,
113 .id_table = id_table, 114 .id_table = id_table,
114 .num_interrupt_in = NUM_DONT_CARE, 115 .num_interrupt_in = NUM_DONT_CARE,
115 .num_bulk_in = 0, 116 .num_bulk_in = 0,
@@ -136,7 +137,7 @@ struct kobil_private {
136 int cur_pos; // index of the next char to send in buf 137 int cur_pos; // index of the next char to send in buf
137 __u16 device_type; 138 __u16 device_type;
138 int line_state; 139 int line_state;
139 struct termios internal_termios; 140 struct ktermios internal_termios;
140}; 141};
141 142
142 143
@@ -269,7 +270,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
269 } 270 }
270 271
271 // allocate memory for write_urb transfer buffer 272 // allocate memory for write_urb transfer buffer
272 port->write_urb->transfer_buffer = (unsigned char *) kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL); 273 port->write_urb->transfer_buffer = kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL);
273 if (! port->write_urb->transfer_buffer) { 274 if (! port->write_urb->transfer_buffer) {
274 kfree(transfer_buffer); 275 kfree(transfer_buffer);
275 usb_free_urb(port->write_urb); 276 usb_free_urb(port->write_urb);
@@ -624,11 +625,11 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
624 625
625 switch (cmd) { 626 switch (cmd) {
626 case TCGETS: // 0x5401 627 case TCGETS: // 0x5401
627 if (!access_ok(VERIFY_WRITE, user_arg, sizeof(struct termios))) { 628 if (!access_ok(VERIFY_WRITE, user_arg, sizeof(struct ktermios))) {
628 dbg("%s - port %d Error in access_ok", __FUNCTION__, port->number); 629 dbg("%s - port %d Error in access_ok", __FUNCTION__, port->number);
629 return -EFAULT; 630 return -EFAULT;
630 } 631 }
631 if (kernel_termios_to_user_termios((struct termios __user *)arg, 632 if (kernel_termios_to_user_termios((struct ktermios __user *)arg,
632 &priv->internal_termios)) 633 &priv->internal_termios))
633 return -EFAULT; 634 return -EFAULT;
634 return 0; 635 return 0;
@@ -638,12 +639,12 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
638 dbg("%s - port %d Error: port->tty->termios is NULL", __FUNCTION__, port->number); 639 dbg("%s - port %d Error: port->tty->termios is NULL", __FUNCTION__, port->number);
639 return -ENOTTY; 640 return -ENOTTY;
640 } 641 }
641 if (!access_ok(VERIFY_READ, user_arg, sizeof(struct termios))) { 642 if (!access_ok(VERIFY_READ, user_arg, sizeof(struct ktermios))) {
642 dbg("%s - port %d Error in access_ok", __FUNCTION__, port->number); 643 dbg("%s - port %d Error in access_ok", __FUNCTION__, port->number);
643 return -EFAULT; 644 return -EFAULT;
644 } 645 }
645 if (user_termios_to_kernel_termios(&priv->internal_termios, 646 if (user_termios_to_kernel_termios(&priv->internal_termios,
646 (struct termios __user *)arg)) 647 (struct ktermios __user *)arg))
647 return -EFAULT; 648 return -EFAULT;
648 649
649 settings = kzalloc(50, GFP_KERNEL); 650 settings = kzalloc(50, GFP_KERNEL);
@@ -696,7 +697,7 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
696 return 0; 697 return 0;
697 698
698 case TCFLSH: // 0x540B 699 case TCFLSH: // 0x540B
699 transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); 700 transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL);
700 if (! transfer_buffer) { 701 if (! transfer_buffer) {
701 return -ENOBUFS; 702 return -ENOBUFS;
702 } 703 }