TTY: resolve Coverity warnings
This commit is contained in:
parent
533f61249b
commit
bc404a9401
2 changed files with 25 additions and 14 deletions
|
@ -1072,7 +1072,7 @@ message *m_ptr; /* pointer to the request message */
|
||||||
/* This procedure allows processes to register a function key to receive
|
/* This procedure allows processes to register a function key to receive
|
||||||
* notifications if it is pressed. At most one binding per key can exist.
|
* notifications if it is pressed. At most one binding per key can exist.
|
||||||
*/
|
*/
|
||||||
int i;
|
int s, i;
|
||||||
int result = EINVAL;
|
int result = EINVAL;
|
||||||
|
|
||||||
switch (m_ptr->FKEY_REQUEST) { /* see what we must do */
|
switch (m_ptr->FKEY_REQUEST) { /* see what we must do */
|
||||||
|
@ -1161,7 +1161,8 @@ message *m_ptr; /* pointer to the request message */
|
||||||
|
|
||||||
/* Almost done, return result to caller. */
|
/* Almost done, return result to caller. */
|
||||||
m_ptr->m_type = result;
|
m_ptr->m_type = result;
|
||||||
send(m_ptr->m_source, m_ptr);
|
if ((s = sendnb(m_ptr->m_source, m_ptr)) != OK)
|
||||||
|
printf("TTY: unable to reply to %d: %d", m_ptr->m_source, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
|
|
|
@ -217,7 +217,7 @@ static int rs_write(register tty_t *tp, int try)
|
||||||
/* (*devwrite)() routine for RS232. */
|
/* (*devwrite)() routine for RS232. */
|
||||||
|
|
||||||
rs232_t *rs = tp->tty_priv;
|
rs232_t *rs = tp->tty_priv;
|
||||||
int count, ocount;
|
int r, count, ocount;
|
||||||
|
|
||||||
if (rs->inhibited != tp->tty_inhibited) {
|
if (rs->inhibited != tp->tty_inhibited) {
|
||||||
/* Inhibition state has changed. */
|
/* Inhibition state has changed. */
|
||||||
|
@ -248,8 +248,9 @@ static int rs_write(register tty_t *tp, int try)
|
||||||
if (try) return 1;
|
if (try) return 1;
|
||||||
|
|
||||||
/* Copy from user space to the RS232 output buffer. */
|
/* Copy from user space to the RS232 output buffer. */
|
||||||
sys_safecopyfrom(tp->tty_outcaller, tp->tty_outgrant,
|
if ((r = sys_safecopyfrom(tp->tty_outcaller, tp->tty_outgrant,
|
||||||
tp->tty_outoffset, (vir_bytes) rs->ohead, count);
|
tp->tty_outoffset, (vir_bytes) rs->ohead, count)) != OK)
|
||||||
|
printf("TTY: sys_safecopyfrom() failed: %d", r);
|
||||||
|
|
||||||
/* Perform output processing on the output buffer. */
|
/* Perform output processing on the output buffer. */
|
||||||
out_process(tp, rs->obuf, rs->ohead, bufend(rs->obuf), &count, &ocount);
|
out_process(tp, rs->obuf, rs->ohead, bufend(rs->obuf), &count, &ocount);
|
||||||
|
@ -432,7 +433,7 @@ void rs_init(tty_t *tp)
|
||||||
register rs232_t *rs;
|
register rs232_t *rs;
|
||||||
int line;
|
int line;
|
||||||
port_t this_8250;
|
port_t this_8250;
|
||||||
int irq;
|
int s, irq;
|
||||||
char l[10];
|
char l[10];
|
||||||
|
|
||||||
/* Associate RS232 and TTY structures. */
|
/* Associate RS232 and TTY structures. */
|
||||||
|
@ -486,8 +487,10 @@ void rs_init(tty_t *tp)
|
||||||
* and will occur when interrupts are enabled anyway. Set up the output
|
* and will occur when interrupts are enabled anyway. Set up the output
|
||||||
* queue using the status from clearing the modem status interrupt.
|
* queue using the status from clearing the modem status interrupt.
|
||||||
*/
|
*/
|
||||||
sys_inb(rs->line_status_port, &dummy);
|
if ((s = sys_inb(rs->line_status_port, &dummy)) != OK)
|
||||||
sys_inb(rs->recv_port, &dummy);
|
printf("TTY: sys_inb() failed: %d", s);
|
||||||
|
if ((s = sys_inb(rs->recv_port, &dummy)) != OK)
|
||||||
|
printf("TTY: sys_inb() failed: %d", s);
|
||||||
rs->ostate = devready(rs) | ORAW | OSWREADY; /* reads modem_ctl_port */
|
rs->ostate = devready(rs) | ORAW | OSWREADY; /* reads modem_ctl_port */
|
||||||
rs->ohead = rs->otail = rs->obuf;
|
rs->ohead = rs->otail = rs->obuf;
|
||||||
|
|
||||||
|
@ -641,8 +644,10 @@ static int rs_break(tty_t *tp, int UNUSED(dummy))
|
||||||
/* Generate a break condition by setting the BREAK bit for 0.4 sec. */
|
/* Generate a break condition by setting the BREAK bit for 0.4 sec. */
|
||||||
rs232_t *rs = tp->tty_priv;
|
rs232_t *rs = tp->tty_priv;
|
||||||
u32_t line_controls;
|
u32_t line_controls;
|
||||||
|
int s;
|
||||||
|
|
||||||
sys_inb(rs->line_ctl_port, &line_controls);
|
if ((s = sys_inb(rs->line_ctl_port, &line_controls)) != OK)
|
||||||
|
printf("TTY: sys_inb() failed: %d", s);
|
||||||
sys_outb(rs->line_ctl_port, line_controls | LC_BREAK);
|
sys_outb(rs->line_ctl_port, line_controls | LC_BREAK);
|
||||||
/* XXX */
|
/* XXX */
|
||||||
/* milli_delay(400); */ /* ouch */
|
/* milli_delay(400); */ /* ouch */
|
||||||
|
@ -673,6 +678,7 @@ static int rs_close(tty_t *tp, int UNUSED(dummy))
|
||||||
static void rs232_handler(struct rs232 *rs)
|
static void rs232_handler(struct rs232 *rs)
|
||||||
{
|
{
|
||||||
/* Interrupt hander for RS232. */
|
/* Interrupt hander for RS232. */
|
||||||
|
int s;
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
u32_t v;
|
u32_t v;
|
||||||
|
@ -681,7 +687,8 @@ static void rs232_handler(struct rs232 *rs)
|
||||||
* (and then we have to worry about being stuck in the loop too long).
|
* (and then we have to worry about being stuck in the loop too long).
|
||||||
* Unfortunately, some serial cards lock up without this.
|
* Unfortunately, some serial cards lock up without this.
|
||||||
*/
|
*/
|
||||||
sys_inb(rs->int_id_port, &v);
|
if ((s = sys_inb(rs->int_id_port, &v)) != OK)
|
||||||
|
printf("TTY: sys_inb() failed: %d", s);
|
||||||
switch (v) {
|
switch (v) {
|
||||||
case IS_RECEIVER_READY:
|
case IS_RECEIVER_READY:
|
||||||
in_int(rs);
|
in_int(rs);
|
||||||
|
@ -712,14 +719,15 @@ static void in_int(register rs232_t *rs)
|
||||||
* Put data in the buffer if room, otherwise discard it.
|
* Put data in the buffer if room, otherwise discard it.
|
||||||
* Set a flag for the clock interrupt handler to eventually notify TTY.
|
* Set a flag for the clock interrupt handler to eventually notify TTY.
|
||||||
*/
|
*/
|
||||||
|
int s;
|
||||||
u32_t c;
|
u32_t c;
|
||||||
|
|
||||||
#if 0 /* Enable this if you want serial input in the kernel */
|
#if 0 /* Enable this if you want serial input in the kernel */
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sys_inb(rs->recv_port, &c);
|
if ((s = sys_inb(rs->recv_port, &c)) != OK)
|
||||||
|
printf("TTY: sys_inb() failed: %d", s);
|
||||||
|
|
||||||
if (!(rs->ostate & ORAW)) {
|
if (!(rs->ostate & ORAW)) {
|
||||||
if (c == rs->oxoff) {
|
if (c == rs->oxoff) {
|
||||||
|
@ -755,9 +763,11 @@ static void line_int(register rs232_t *rs)
|
||||||
/* rs line with line status interrupt */
|
/* rs line with line status interrupt */
|
||||||
{
|
{
|
||||||
/* Check for and record errors. */
|
/* Check for and record errors. */
|
||||||
|
int r;
|
||||||
u32_t s;
|
u32_t s;
|
||||||
sys_inb(rs->line_status_port, &s);
|
|
||||||
|
if ((r = sys_inb(rs->line_status_port, &s)) != OK)
|
||||||
|
printf("TTY: sys_inb() failed: %d", r);
|
||||||
rs->lstatus = s;
|
rs->lstatus = s;
|
||||||
if (rs->lstatus & LS_FRAMING_ERR) ++rs->framing_errors;
|
if (rs->lstatus & LS_FRAMING_ERR) ++rs->framing_errors;
|
||||||
if (rs->lstatus & LS_OVERRUN_ERR) ++rs->overrun_errors;
|
if (rs->lstatus & LS_OVERRUN_ERR) ++rs->overrun_errors;
|
||||||
|
|
Loading…
Reference in a new issue