Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51383f69 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds
Browse files

tty: Remove lots of NULL checks



Many tty drivers contain 'can't happen' checks against NULL pointers passed
in by the tty layer. These have never been possible to occur. Even more
importantly if they ever do occur we want to know as it would be a serious
bug.

Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ea1afd25
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -837,9 +837,6 @@ static int rs_put_char(struct tty_struct *tty, unsigned char ch)
	struct async_struct *info;
	unsigned long flags;

	if (!tty)
		return 0;

	info = tty->driver_data;

	if (serial_paranoia_check(info, tty->name, "rs_put_char"))
@@ -892,9 +889,6 @@ static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count
	struct async_struct *info;
	unsigned long flags;

	if (!tty)
		return 0;

	info = tty->driver_data;

	if (serial_paranoia_check(info, tty->name, "rs_write"))
+0 −21
Original line number Diff line number Diff line
@@ -54,8 +54,6 @@ int gs_put_char(struct tty_struct * tty, unsigned char ch)

	func_enter (); 

	if (!tty) return 0;

	port = tty->driver_data;

	if (!port) return 0;
@@ -97,8 +95,6 @@ int gs_write(struct tty_struct * tty,

	func_enter ();

	if (!tty) return 0;

	port = tty->driver_data;

	if (!port) return 0;
@@ -185,7 +181,6 @@ static int gs_real_chars_in_buffer(struct tty_struct *tty)
	struct gs_port *port;
	func_enter ();

	if (!tty) return 0;
	port = tty->driver_data;

	if (!port->rd) return 0;
@@ -274,8 +269,6 @@ void gs_flush_buffer(struct tty_struct *tty)

	func_enter ();

	if (!tty) return;

	port = tty->driver_data;

	if (!port) return;
@@ -296,8 +289,6 @@ void gs_flush_chars(struct tty_struct * tty)

	func_enter ();

	if (!tty) return;

	port = tty->driver_data;

	if (!port) return;
@@ -321,8 +312,6 @@ void gs_stop(struct tty_struct * tty)

	func_enter ();

	if (!tty) return;

	port = tty->driver_data;

	if (!port) return;
@@ -341,8 +330,6 @@ void gs_start(struct tty_struct * tty)
{
	struct gs_port *port;

	if (!tty) return;

	port = tty->driver_data;

	if (!port) return;
@@ -393,8 +380,6 @@ void gs_hangup(struct tty_struct *tty)

	func_enter ();

	if (!tty) return;

	port = tty->driver_data;
	tty = port->port.tty;
	if (!tty) 
@@ -426,8 +411,6 @@ int gs_block_til_ready(void *port_, struct file * filp)

	tty = port->port.tty;

	if (!tty) return 0;

	gs_dprintk (GS_DEBUG_BTR, "Entering gs_block_till_ready.\n"); 
	/*
	 * If the device is in the middle of being closed, then block
@@ -523,8 +506,6 @@ void gs_close(struct tty_struct * tty, struct file * filp)
	
	func_enter ();

	if (!tty) return;

	port = (struct gs_port *) tty->driver_data;

	if (!port) return;
@@ -621,8 +602,6 @@ void gs_set_termios (struct tty_struct * tty,

	func_enter();

	if (!tty) return;

	port = tty->driver_data;

	if (!port) return;
+0 −6
Original line number Diff line number Diff line
@@ -1375,8 +1375,6 @@ static void stli_flushchars(struct tty_struct *tty)
	stli_txcookrealsize = 0;
	stli_txcooktty = NULL;

	if (tty == NULL)
		return;
	if (cooktty == NULL)
		return;
	if (tty != cooktty)
@@ -1732,8 +1730,6 @@ static void stli_settermios(struct tty_struct *tty, struct ktermios *old)
	struct ktermios *tiosp;
	asyport_t aport;

	if (tty == NULL)
		return;
	portp = tty->driver_data;
	if (portp == NULL)
		return;
@@ -1938,8 +1934,6 @@ static void stli_waituntilsent(struct tty_struct *tty, int timeout)
	struct stliport *portp;
	unsigned long tend;

	if (tty == NULL)
		return;
	portp = tty->driver_data;
	if (portp == NULL)
		return;
+0 −5
Original line number Diff line number Diff line
@@ -616,9 +616,6 @@ static int mxser_set_baud(struct tty_struct *tty, long newspd)
	int quot = 0, baud;
	unsigned char cval;

	if (!tty->termios)
		return -1;

	if (!info->ioaddr)
		return -1;

@@ -688,8 +685,6 @@ static int mxser_change_speed(struct tty_struct *tty,
	int ret = 0;
	unsigned char status;

	if (!tty->termios)
		return ret;
	cflag = tty->termios->c_cflag;
	if (!info->ioaddr)
		return ret;
+1 −7
Original line number Diff line number Diff line
@@ -372,14 +372,8 @@ static void remove_from_rx_queue(struct r3964_info *pInfo,
static void put_char(struct r3964_info *pInfo, unsigned char ch)
{
	struct tty_struct *tty = pInfo->tty;

	if (tty == NULL)
		return;

	/* FIXME: put_char should not be called from an IRQ */
	if (tty->ops->put_char) {
		tty->ops->put_char(tty, ch);
	}
	tty_put_char(tty, ch);
	pInfo->bcc ^= ch;
}

Loading