Commit 5c58097e authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

tty: vcc, remove useless tty checks



All these functions are called with a valid tty pointer, no need to
check that.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210302062214.29627-28-jslaby@suse.cz


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9af6f74d
Loading
Loading
Loading
Loading
+0 −45
Original line number Diff line number Diff line
@@ -726,11 +726,6 @@ static int vcc_open(struct tty_struct *tty, struct file *vcc_file)
{
	struct vcc_port *port;

	if (unlikely(!tty)) {
		pr_err("VCC: open: Invalid TTY handle\n");
		return -ENXIO;
	}

	if (tty->count > 1)
		return -EBUSY;

@@ -764,11 +759,6 @@ static int vcc_open(struct tty_struct *tty, struct file *vcc_file)

static void vcc_close(struct tty_struct *tty, struct file *vcc_file)
{
	if (unlikely(!tty)) {
		pr_err("VCC: close: Invalid TTY handle\n");
		return;
	}

	if (unlikely(tty->count > 1))
		return;

@@ -796,11 +786,6 @@ static void vcc_hangup(struct tty_struct *tty)
{
	struct vcc_port *port;

	if (unlikely(!tty)) {
		pr_err("VCC: hangup: Invalid TTY handle\n");
		return;
	}

	port = vcc_get_ne(tty->index);
	if (unlikely(!port)) {
		pr_err("VCC: hangup: Failed to find VCC port\n");
@@ -830,11 +815,6 @@ static int vcc_write(struct tty_struct *tty, const unsigned char *buf,
	int tosend = 0;
	int rv = -EINVAL;

	if (unlikely(!tty)) {
		pr_err("VCC: write: Invalid TTY handle\n");
		return -ENXIO;
	}

	port = vcc_get_ne(tty->index);
	if (unlikely(!port)) {
		pr_err("VCC: write: Failed to find VCC port");
@@ -895,11 +875,6 @@ static int vcc_write_room(struct tty_struct *tty)
	struct vcc_port *port;
	u64 num;

	if (unlikely(!tty)) {
		pr_err("VCC: write_room: Invalid TTY handle\n");
		return -ENXIO;
	}

	port = vcc_get_ne(tty->index);
	if (unlikely(!port)) {
		pr_err("VCC: write_room: Failed to find VCC port\n");
@@ -918,11 +893,6 @@ static int vcc_chars_in_buffer(struct tty_struct *tty)
	struct vcc_port *port;
	u64 num;

	if (unlikely(!tty)) {
		pr_err("VCC: chars_in_buffer: Invalid TTY handle\n");
		return -ENXIO;
	}

	port = vcc_get_ne(tty->index);
	if (unlikely(!port)) {
		pr_err("VCC: chars_in_buffer: Failed to find VCC port\n");
@@ -941,11 +911,6 @@ static int vcc_break_ctl(struct tty_struct *tty, int state)
	struct vcc_port *port;
	unsigned long flags;

	if (unlikely(!tty)) {
		pr_err("VCC: break_ctl: Invalid TTY handle\n");
		return -ENXIO;
	}

	port = vcc_get_ne(tty->index);
	if (unlikely(!port)) {
		pr_err("VCC: break_ctl: Failed to find VCC port\n");
@@ -976,11 +941,6 @@ static int vcc_install(struct tty_driver *driver, struct tty_struct *tty)
	struct tty_port *port_tty;
	int ret;

	if (unlikely(!tty)) {
		pr_err("VCC: install: Invalid TTY handle\n");
		return -ENXIO;
	}

	if (tty->index >= VCC_MAX_PORTS)
		return -EINVAL;

@@ -1015,11 +975,6 @@ static void vcc_cleanup(struct tty_struct *tty)
{
	struct vcc_port *port;

	if (unlikely(!tty)) {
		pr_err("VCC: cleanup: Invalid TTY handle\n");
		return;
	}

	port = vcc_get(tty->index, true);
	if (port) {
		port->tty = NULL;