Commit 0cc8b902 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: remove serial_paranoia_check() function

If this is hiding real problems, we need to find them.
parent c63063e2
...@@ -265,7 +265,6 @@ static void belkin_sa_read_int_callback (struct urb *urb, struct pt_regs *regs) ...@@ -265,7 +265,6 @@ static void belkin_sa_read_int_callback (struct urb *urb, struct pt_regs *regs)
{ {
struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct belkin_sa_private *priv; struct belkin_sa_private *priv;
struct usb_serial *serial;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int retval; int retval;
unsigned long flags; unsigned long flags;
...@@ -285,11 +284,6 @@ static void belkin_sa_read_int_callback (struct urb *urb, struct pt_regs *regs) ...@@ -285,11 +284,6 @@ static void belkin_sa_read_int_callback (struct urb *urb, struct pt_regs *regs)
goto exit; goto exit;
} }
serial = port->serial;
if (serial_paranoia_check (serial, __FUNCTION__))
return;
usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data); usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
/* Handle known interrupt data */ /* Handle known interrupt data */
......
...@@ -318,7 +318,6 @@ static void cyberjack_read_int_callback( struct urb *urb, struct pt_regs *regs ) ...@@ -318,7 +318,6 @@ static void cyberjack_read_int_callback( struct urb *urb, struct pt_regs *regs )
{ {
struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct cyberjack_private *priv = usb_get_serial_port_data(port); struct cyberjack_private *priv = usb_get_serial_port_data(port);
struct usb_serial *serial;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int result; int result;
...@@ -328,10 +327,6 @@ static void cyberjack_read_int_callback( struct urb *urb, struct pt_regs *regs ) ...@@ -328,10 +327,6 @@ static void cyberjack_read_int_callback( struct urb *urb, struct pt_regs *regs )
if (urb->status) if (urb->status)
return; return;
serial = port->serial;
if (serial_paranoia_check (serial, __FUNCTION__))
return;
usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data); usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
/* React only to interrupts signaling a bulk_in transfer */ /* React only to interrupts signaling a bulk_in transfer */
......
...@@ -1396,10 +1396,6 @@ dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status ); ...@@ -1396,10 +1396,6 @@ dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status );
return; return;
} }
/* further sanity checks */
if (serial_paranoia_check(serial, __FUNCTION__))
return;
/* try to send any buffered data on this port, if it is open */ /* try to send any buffered data on this port, if it is open */
spin_lock( &priv->dp_port_lock ); spin_lock( &priv->dp_port_lock );
priv->dp_write_urb_in_use = 0; priv->dp_write_urb_in_use = 0;
...@@ -1797,7 +1793,6 @@ dbg( "digi_read_bulk_callback: TOP" ); ...@@ -1797,7 +1793,6 @@ dbg( "digi_read_bulk_callback: TOP" );
return; return;
} }
if( port->serial == NULL if( port->serial == NULL
|| serial_paranoia_check( port->serial, __FUNCTION__ )
|| (serial_priv=usb_get_serial_data(port->serial)) == NULL ) { || (serial_priv=usb_get_serial_data(port->serial)) == NULL ) {
err("%s: serial is bad or serial->private is NULL, status=%d", __FUNCTION__, urb->status ); err("%s: serial is bad or serial->private is NULL, status=%d", __FUNCTION__, urb->status );
return; return;
......
...@@ -776,10 +776,6 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs) ...@@ -776,10 +776,6 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs)
dbg("%s", __FUNCTION__); dbg("%s", __FUNCTION__);
if (serial_paranoia_check (edge_serial->serial, __FUNCTION__)) {
return;
}
switch (urb->status) { switch (urb->status) {
case 0: case 0:
/* success */ /* success */
...@@ -865,10 +861,6 @@ static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs) ...@@ -865,10 +861,6 @@ static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs)
dbg("%s", __FUNCTION__); dbg("%s", __FUNCTION__);
if (serial_paranoia_check (edge_serial->serial, __FUNCTION__)) {
return;
}
if (urb->status) { if (urb->status) {
dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status); dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
return; return;
......
...@@ -1649,10 +1649,6 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs) ...@@ -1649,10 +1649,6 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs)
dbg("%s", __FUNCTION__); dbg("%s", __FUNCTION__);
if (serial_paranoia_check (edge_serial->serial, __FUNCTION__)) {
return;
}
switch (urb->status) { switch (urb->status) {
case 0: case 0:
/* success */ /* success */
......
...@@ -226,8 +226,7 @@ static void keyspan_pda_request_unthrottle( struct usb_serial *serial ) ...@@ -226,8 +226,7 @@ static void keyspan_pda_request_unthrottle( struct usb_serial *serial )
static void keyspan_pda_rx_interrupt (struct urb *urb, struct pt_regs *regs) static void keyspan_pda_rx_interrupt (struct urb *urb, struct pt_regs *regs)
{ {
struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct usb_serial *serial; struct tty_struct *tty = port->tty;
struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int i; int i;
int status; int status;
...@@ -249,17 +248,11 @@ static void keyspan_pda_rx_interrupt (struct urb *urb, struct pt_regs *regs) ...@@ -249,17 +248,11 @@ static void keyspan_pda_rx_interrupt (struct urb *urb, struct pt_regs *regs)
goto exit; goto exit;
} }
serial = port->serial;
if (serial_paranoia_check (serial, "keyspan_pda_rx_interrupt")) {
return;
}
/* see if the message is data or a status interrupt */ /* see if the message is data or a status interrupt */
switch (data[0]) { switch (data[0]) {
case 0: case 0:
/* rest of message is rx data */ /* rest of message is rx data */
if (urb->actual_length) { if (urb->actual_length) {
tty = serial->port[0]->tty;
for (i = 1; i < urb->actual_length ; ++i) { for (i = 1; i < urb->actual_length ; ++i) {
tty_insert_flip_char(tty, data[i], 0); tty_insert_flip_char(tty, data[i], 0);
} }
...@@ -273,7 +266,6 @@ static void keyspan_pda_rx_interrupt (struct urb *urb, struct pt_regs *regs) ...@@ -273,7 +266,6 @@ static void keyspan_pda_rx_interrupt (struct urb *urb, struct pt_regs *regs)
case 1: /* modemline change */ case 1: /* modemline change */
break; break;
case 2: /* tx unthrottle interrupt */ case 2: /* tx unthrottle interrupt */
tty = serial->port[0]->tty;
priv->tx_throttled = 0; priv->tx_throttled = 0;
/* queue up a wakeup at scheduler time */ /* queue up a wakeup at scheduler time */
schedule_work(&priv->wakeup_work); schedule_work(&priv->wakeup_work);
...@@ -628,16 +620,10 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user, ...@@ -628,16 +620,10 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user,
static void keyspan_pda_write_bulk_callback (struct urb *urb, struct pt_regs *regs) static void keyspan_pda_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
{ {
struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct usb_serial *serial;
struct keyspan_pda_private *priv; struct keyspan_pda_private *priv;
priv = usb_get_serial_port_data(port); priv = usb_get_serial_port_data(port);
serial = port->serial;
if (serial_paranoia_check (serial, "keyspan_pda_rx_interrupt")) {
return;
}
/* queue up a wakeup at scheduler time */ /* queue up a wakeup at scheduler time */
schedule_work(&priv->wakeup_work); schedule_work(&priv->wakeup_work);
} }
......
...@@ -338,15 +338,9 @@ static void omninet_write_bulk_callback (struct urb *urb, struct pt_regs *regs) ...@@ -338,15 +338,9 @@ static void omninet_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
{ {
/* struct omninet_header *header = (struct omninet_header *) urb->transfer_buffer; */ /* struct omninet_header *header = (struct omninet_header *) urb->transfer_buffer; */
struct usb_serial_port *port = (struct usb_serial_port *) urb->context; struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
struct usb_serial *serial;
// dbg("omninet_write_bulk_callback, port %0x\n", port); // dbg("omninet_write_bulk_callback, port %0x\n", port);
serial = port->serial;
if (serial_paranoia_check (serial, __FUNCTION__)) {
return;
}
if (urb->status) { if (urb->status) {
dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
return; return;
......
...@@ -803,9 +803,6 @@ static void pl2303_write_bulk_callback (struct urb *urb, struct pt_regs *regs) ...@@ -803,9 +803,6 @@ static void pl2303_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
if (urb->status) { if (urb->status) {
/* error in the urb, so we have to resubmit it */ /* error in the urb, so we have to resubmit it */
if (serial_paranoia_check (port->serial, __FUNCTION__)) {
return;
}
dbg("%s - Overflow in write", __FUNCTION__); dbg("%s - Overflow in write", __FUNCTION__);
dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
port->write_urb->transfer_buffer_length = 1; port->write_urb->transfer_buffer_length = 1;
......
...@@ -460,9 +460,6 @@ static int serial_open (struct tty_struct *tty, struct file * filp) ...@@ -460,9 +460,6 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
/* get the serial object associated with this tty pointer */ /* get the serial object associated with this tty pointer */
serial = usb_serial_get_by_index(tty->index); serial = usb_serial_get_by_index(tty->index);
if (serial_paranoia_check (serial, __FUNCTION__))
return -ENODEV;
/* set up our port structure making the tty driver remember our port object, and us it */ /* set up our port structure making the tty driver remember our port object, and us it */
portNumber = tty->index - serial->minor; portNumber = tty->index - serial->minor;
port = serial->port[portNumber]; port = serial->port[portNumber];
......
...@@ -294,26 +294,10 @@ extern struct usb_serial_device_type usb_serial_generic_device; ...@@ -294,26 +294,10 @@ extern struct usb_serial_device_type usb_serial_generic_device;
extern struct bus_type usb_serial_bus_type; extern struct bus_type usb_serial_bus_type;
extern struct tty_driver *usb_serial_tty_driver; extern struct tty_driver *usb_serial_tty_driver;
/* Inline functions to check the sanity of a pointer that is passed to us */
static inline int serial_paranoia_check (struct usb_serial *serial, const char *function)
{
if (!serial) {
dbg("%s - serial == NULL", function);
return -1;
}
if (!serial->type) {
dbg("%s - serial->type == NULL!", function);
return -1;
}
return 0;
}
static inline struct usb_serial* get_usb_serial (struct usb_serial_port *port, const char *function) static inline struct usb_serial* get_usb_serial (struct usb_serial_port *port, const char *function)
{ {
/* if no port was specified, or it fails a paranoia check */ /* if no port was specified, or it fails a paranoia check */
if (!port || if (!port) {
serial_paranoia_check (port->serial, function)) {
/* then say that we don't have a valid usb_serial thing, which will /* then say that we don't have a valid usb_serial thing, which will
* end up genrating -ENODEV return values */ * end up genrating -ENODEV return values */
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment