X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=drivers%2Fchar%2Fsx.c;h=a6b4f02bdceb06ba347d5241f6b479eacecbb36a;hb=0f511ea70600efb1e06d7b55e1c51a83aff8713c;hp=c2490e270f1fc92b280b477eaff5605bbb4b79e6;hpb=7b875affd49fbc8978a1a898a0a80ebfff11f8c6;p=linux-2.6-omap-h63xx.git diff --git a/drivers/char/sx.c b/drivers/char/sx.c index c2490e270f1..a6b4f02bdce 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -1095,17 +1095,17 @@ static inline void sx_receive_chars (struct sx_port *port) sx_dprintk (SX_DEBUG_RECEIVE, "rxop=%d, c = %d.\n", rx_op, c); + /* Don't copy past the end of the hardware receive buffer */ + if (rx_op + c > 0x100) c = 0x100 - rx_op; + + sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); + /* Don't copy more bytes than there is room for in the buffer */ c = tty_prepare_flip_string(tty, &rp, c); sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); - /* Don't copy past the end of the hardware receive buffer */ - if (rx_op + c > 0x100) c = 0x100 - rx_op; - - sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); - /* If for one reason or another, we can't copy more data, we're done! */ if (c == 0) break; @@ -2173,15 +2173,17 @@ static int probe_si (struct sx_board *board) if ( IS_SI1_BOARD(board)) { /* This should be an SI1 board, which has this location writable... */ - if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) + if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) { func_exit (); return 0; + } } else { /* This should be an SI2 board, which has the bottom 3 bits non-writable... */ - if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) + if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) { func_exit (); return 0; + } } /* Now we're pretty much convinced that there is an SI board here, @@ -2192,15 +2194,17 @@ static int probe_si (struct sx_board *board) if ( IS_SI1_BOARD(board)) { /* This should be an SI1 board, which has this location writable... */ - if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) + if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) { func_exit(); return 0; + } } else { /* This should be an SI2 board, which has the bottom 3 bits non-writable... */ - if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) + if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) { func_exit (); return 0; + } } printheader ();