public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH RESEND #2 1/3] serqt_usb2: drag screaming into the 21st century
  2012-08-08 15:27 [PATCH RESEND #2 1/3] serqt_usb2: drag screaming into the 21st century Alan Cox
@ 2012-08-08 15:23 ` Greg KH
  2012-08-08 15:29 ` [PATCH RESEND #2 2/3] tty: fix missing assignment Alan Cox
  2012-08-08 15:29 ` [PATCH RESEND #2 3/3] tty: handle NULL parameters in free_tty_struct() Alan Cox
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2012-08-08 15:23 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

On Wed, Aug 08, 2012 at 04:27:55PM +0100, Alan Cox wrote:
> From: Alan Cox <alan@linux.intel.com>
> 
> Fix the termios stuff but while we are at it do something about the rest of
> it
> 
> Signed-off-by: Alan Cox <alan@linux.intel.com>

Thanks, I'll apply these tomorrow when I get the chance to catch up on
pending patches, sorry for the delay, been traveling.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH RESEND #2 1/3] serqt_usb2: drag screaming into the 21st century
@ 2012-08-08 15:27 Alan Cox
  2012-08-08 15:23 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alan Cox @ 2012-08-08 15:27 UTC (permalink / raw)
  To: greg, linux-kernel

From: Alan Cox <alan@linux.intel.com>

Fix the termios stuff but while we are at it do something about the rest of
it

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/staging/serqt_usb2/serqt_usb2.c |   18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c
index 8a362f7..c90de96 100644
--- a/drivers/staging/serqt_usb2/serqt_usb2.c
+++ b/drivers/staging/serqt_usb2/serqt_usb2.c
@@ -315,10 +315,8 @@ static void qt_read_bulk_callback(struct urb *urb)
 	}
 
 	tty = tty_port_tty_get(&port->port);
-	if (!tty) {
-		dbg("%s - bad tty pointer - exiting", __func__);
+	if (!tty)
 		return;
-	}
 
 	data = urb->transfer_buffer;
 
@@ -364,7 +362,7 @@ static void qt_read_bulk_callback(struct urb *urb)
 		goto exit;
 	}
 
-	if (tty && RxCount) {
+	if (RxCount) {
 		flag_data = 0;
 		for (i = 0; i < RxCount; ++i) {
 			/* Look ahead code here */
@@ -428,7 +426,7 @@ static void qt_read_bulk_callback(struct urb *urb)
 		dbg("%s - failed resubmitting read urb, error %d",
 		    __func__, result);
 	else {
-		if (tty && RxCount) {
+		if (RxCount) {
 			tty_flip_buffer_push(tty);
 			tty_schedule_flip(tty);
 		}
@@ -897,8 +895,6 @@ static int qt_open(struct tty_struct *tty,
 	 * Put this here to make it responsive to stty and defaults set by
 	 * the tty layer
 	 */
-	/* FIXME: is this needed? */
-	/* qt_set_termios(tty, port, NULL); */
 
 	/*  Check to see if we've set up our endpoint info yet */
 	if (port0->open_ports == 1) {
@@ -1195,7 +1191,7 @@ static void qt_set_termios(struct tty_struct *tty,
 			   struct usb_serial_port *port,
 			   struct ktermios *old_termios)
 {
-	struct ktermios *termios = tty->termios;
+	struct ktermios *termios = &tty->termios;
 	unsigned char new_LCR = 0;
 	unsigned int cflag = termios->c_cflag;
 	unsigned int index;
@@ -1204,7 +1200,7 @@ static void qt_set_termios(struct tty_struct *tty,
 
 	index = tty->index - port->serial->minor;
 
-	switch (cflag) {
+	switch (cflag & CSIZE) {
 	case CS5:
 		new_LCR |= SERIAL_5_DATA;
 		break;
@@ -1215,6 +1211,8 @@ static void qt_set_termios(struct tty_struct *tty,
 		new_LCR |= SERIAL_7_DATA;
 		break;
 	default:
+		termios->c_cflag &= ~CSIZE;
+		termios->c_cflag |= CS8;
 	case CS8:
 		new_LCR |= SERIAL_8_DATA;
 		break;
@@ -1301,7 +1299,7 @@ static void qt_set_termios(struct tty_struct *tty,
 			dbg(__FILE__ "BoxSetSW_FlowCtrl (diabling) failed\n");
 
 	}
-	tty->termios->c_cflag &= ~CMSPAR;
+	termios->c_cflag &= ~CMSPAR;
 	/* FIXME: Error cases should be returning the actual bits changed only */
 }
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH RESEND #2 2/3] tty: fix missing assignment
  2012-08-08 15:27 [PATCH RESEND #2 1/3] serqt_usb2: drag screaming into the 21st century Alan Cox
  2012-08-08 15:23 ` Greg KH
@ 2012-08-08 15:29 ` Alan Cox
  2012-08-08 15:29 ` [PATCH RESEND #2 3/3] tty: handle NULL parameters in free_tty_struct() Alan Cox
  2 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2012-08-08 15:29 UTC (permalink / raw)
  To: greg, linux-kernel

From: Dan Carpenter <dan.carpenter@oracle.com>

We're trying to save the termios state and we need to allocate a buffer
to do it.  Smatch complains that the buffer is leaked at the end of the
function.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/tty/tty_io.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index c6f4d71..6087499 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1450,6 +1450,7 @@ void tty_free_termios(struct tty_struct *tty)
 			pr_warn("tty: no memory to save termios state.\n");
 			return;
 		}
+		tty->driver->termios[idx] = tp;
 	}
 	*tp = tty->termios;
 }


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH RESEND #2 3/3] tty: handle NULL parameters in free_tty_struct()
  2012-08-08 15:27 [PATCH RESEND #2 1/3] serqt_usb2: drag screaming into the 21st century Alan Cox
  2012-08-08 15:23 ` Greg KH
  2012-08-08 15:29 ` [PATCH RESEND #2 2/3] tty: fix missing assignment Alan Cox
@ 2012-08-08 15:29 ` Alan Cox
  2 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2012-08-08 15:29 UTC (permalink / raw)
  To: greg, linux-kernel

From: Dan Carpenter <dan.carpenter@oracle.com>

We sometimes pass NULL pointers to free_tty_struct().  One example where
it can happen is in the error handling code in pty_common_install().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---

 drivers/tty/tty_io.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 6087499..6784aae 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -181,6 +181,8 @@ struct tty_struct *alloc_tty_struct(void)
 
 void free_tty_struct(struct tty_struct *tty)
 {
+	if (!tty)
+		return;
 	if (tty->dev)
 		put_device(tty->dev);
 	kfree(tty->write_buf);


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-08 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-08 15:27 [PATCH RESEND #2 1/3] serqt_usb2: drag screaming into the 21st century Alan Cox
2012-08-08 15:23 ` Greg KH
2012-08-08 15:29 ` [PATCH RESEND #2 2/3] tty: fix missing assignment Alan Cox
2012-08-08 15:29 ` [PATCH RESEND #2 3/3] tty: handle NULL parameters in free_tty_struct() Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox