diff options
author | Johan Hovold | 2019-11-07 14:29:00 +0100 |
---|---|---|
committer | Johan Hovold | 2019-11-12 09:57:12 +0100 |
commit | 6d3471eded5e64c0310ceeff4adf9ca6d324ddd7 (patch) | |
tree | 207527b8bbc463904b89d158e11f5212ef5cada9 /drivers/usb/serial | |
parent | ce039bd4b21fdd158e6dbe8baeb577e6347ea7aa (diff) |
USB: serial: mos7840: drop paranoid serial checks
Drop the likewise paranoid serial structure sanity checks.
USB serial core sets the serial pointer in the port structures at
initialisation and it is never cleared, and similar for the serial
structure type.
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/mos7840.c | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index dcb1e04a0514..207b88d948a9 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -446,28 +446,11 @@ static void mos7840_led_activity(struct usb_serial_port *port) jiffies + msecs_to_jiffies(LED_ON_MS)); } -/* Inline functions to check the sanity of a pointer that is passed to us */ -static int mos7840_serial_paranoia_check(struct usb_serial *serial, - const char *function) -{ - if (!serial) { - pr_debug("%s - serial == NULL\n", function); - return -1; - } - if (!serial->type) { - pr_debug("%s - serial->type == NULL!\n", function); - return -1; - } - - return 0; -} - static struct usb_serial *mos7840_get_usb_serial(struct usb_serial_port *port, const char *function) { - /* if no port was specified, or it fails a paranoia check */ - if (!port || - mos7840_serial_paranoia_check(port->serial, function)) { + /* if no port was specified */ + if (!port) { /* then say that we don't have a valid usb_serial thing, * which will end up genrating -ENODEV return values */ return NULL; @@ -586,9 +569,6 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) int status; struct moschip_port *mos7840_port; - if (mos7840_serial_paranoia_check(serial, __func__)) - return -ENODEV; - mos7840_port = mos7840_get_port_private(port); if (mos7840_port == NULL) return -ENODEV; @@ -966,9 +946,6 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, /* __u16 Data; */ const unsigned char *current_position = data; - if (mos7840_serial_paranoia_check(serial, __func__)) - return -1; - mos7840_port = mos7840_get_port_private(port); if (mos7840_port == NULL) return -1; @@ -1248,9 +1225,6 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, __u16 Data; __u16 clk_sel_val; - if (mos7840_serial_paranoia_check(port->serial, __func__)) - return -1; - dev_dbg(&port->dev, "%s - baud = %d\n", __func__, baudRate); /* reset clk_uart_sel in spregOffset */ if (baudRate > 115200) { @@ -1347,9 +1321,6 @@ static void mos7840_change_port_settings(struct tty_struct *tty, int status; __u16 Data; - if (mos7840_serial_paranoia_check(port->serial, __func__)) - return; - if (!mos7840_port->open) { dev_dbg(&port->dev, "%s - port not opened\n", __func__); return; @@ -1488,14 +1459,9 @@ static void mos7840_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios) { - struct usb_serial *serial = port->serial; int status; struct moschip_port *mos7840_port; - - if (mos7840_serial_paranoia_check(serial, __func__)) - return; - mos7840_port = mos7840_get_port_private(port); if (mos7840_port == NULL) |