Skip to content

Commit a2d1e35

Browse files
Alan Coxgregkh
authored andcommitted
tty: Fix regressions in the char driver conversion
This forgot to update a field in the old char drivers. The fact nobody has basically noticed (except one mxser user) rather suggests most of these drivers could go into the bitbucket. Signed-off-by: Alan Cox <alan@linux.intel.com> Cc: Jiri Slaby <jirislaby@gmail.com> Cc: Dan Carpenter <error27@gmail.com> Cc: Andreas Pretzsch <apr@cn-eng.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 66f41d4 commit a2d1e35

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

drivers/char/isicom.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,8 @@ static int isicom_open(struct tty_struct *tty, struct file *filp)
879879
if (tport == NULL)
880880
return -ENODEV;
881881
port = container_of(tport, struct isi_port, port);
882-
card = &isi_card[BOARD(tty->index)];
883882

883+
tty->driver_data = port;
884884
return tty_port_open(tport, tty, filp);
885885
}
886886

@@ -936,7 +936,12 @@ static void isicom_shutdown(struct tty_port *port)
936936
static void isicom_close(struct tty_struct *tty, struct file *filp)
937937
{
938938
struct isi_port *ip = tty->driver_data;
939-
struct tty_port *port = &ip->port;
939+
struct tty_port *port;
940+
941+
if (ip == NULL)
942+
return;
943+
944+
port = &ip->port;
940945
if (isicom_paranoia_check(ip, tty->name, "isicom_close"))
941946
return;
942947
tty_port_close(port, tty, filp);

drivers/char/istallion.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
827827
return -ENODEV;
828828
if (portp->devnr < 1)
829829
return -ENODEV;
830+
831+
tty->driver_data = portp;
830832
return tty_port_open(&portp->port, tty, filp);
831833
}
832834

drivers/char/mxser.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
10111011
if (!info->ioaddr)
10121012
return -ENODEV;
10131013

1014+
tty->driver_data = info;
10141015
return tty_port_open(&info->port, tty, filp);
10151016
}
10161017

@@ -1074,7 +1075,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
10741075
struct mxser_port *info = tty->driver_data;
10751076
struct tty_port *port = &info->port;
10761077

1077-
if (tty->index == MXSER_PORTS)
1078+
if (tty->index == MXSER_PORTS || info == NULL)
10781079
return;
10791080
if (tty_port_close_start(port, tty, filp) == 0)
10801081
return;

drivers/char/riscom8.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,7 @@ static int rc_open(struct tty_struct *tty, struct file *filp)
909909
if (error)
910910
return error;
911911

912+
tty->driver_data = port;
912913
return tty_port_open(&port->port, tty, filp);
913914
}
914915

drivers/char/stallion.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,6 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
724724
{
725725
struct stlport *portp;
726726
struct stlbrd *brdp;
727-
struct tty_port *port;
728727
unsigned int minordev, brdnr, panelnr;
729728
int portnr;
730729

@@ -754,7 +753,8 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
754753
portp = brdp->panels[panelnr]->ports[portnr];
755754
if (portp == NULL)
756755
return -ENODEV;
757-
port = &portp->port;
756+
757+
tty->driver_data = portp;
758758
return tty_port_open(&portp->port, tty, filp);
759759

760760
}
@@ -841,7 +841,8 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
841841
pr_debug("stl_close(tty=%p,filp=%p)\n", tty, filp);
842842

843843
portp = tty->driver_data;
844-
BUG_ON(portp == NULL);
844+
if(portp == NULL)
845+
return;
845846
tty_port_close(&portp->port, tty, filp);
846847
}
847848

0 commit comments

Comments
 (0)