summaryrefslogtreecommitdiff
path: root/components/drivers/tty
diff options
context:
space:
mode:
authorSparks-Pion <[email protected]>2023-04-04 12:33:10 +0800
committerGitHub <[email protected]>2023-04-04 00:33:10 -0400
commitaccab17fa5eafc800c4ba464a0f6fcc1d1e008eb (patch)
tree82fae58ffc459407d673042edfa51a7abbe52078 /components/drivers/tty
parent3bee170d5297ce9a142b20294a34822bd030d2c2 (diff)
[HUST CSE IoTS&P Lab] [fix] check rt_mutex_create return value (#7169)
Diffstat (limited to 'components/drivers/tty')
-rw-r--r--components/drivers/tty/n_tty.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/components/drivers/tty/n_tty.c b/components/drivers/tty/n_tty.c
index 658c6c0d9e..ba27ae134b 100644
--- a/components/drivers/tty/n_tty.c
+++ b/components/drivers/tty/n_tty.c
@@ -536,7 +536,7 @@ static void __isig(int sig, struct tty_struct *tty)
if (sig == SIGTSTP)
{
struct rt_lwp *old_lwp;
-
+
rt_memcpy(&old_termios, &(tty->init_termios), sizeof(struct termios));
tty->init_termios = *new_termios;
ld = tty->ldisc;
@@ -549,7 +549,7 @@ static void __isig(int sig, struct tty_struct *tty)
}
tty_sigaddset(&lwp->signal_mask, SIGTTOU);
old_lwp = tty_pop(&tty->head, RT_NULL);
- tty->foreground = old_lwp;
+ tty->foreground = old_lwp;
}
else
{
@@ -805,7 +805,7 @@ static size_t __process_echoes(struct tty_struct *tty)
unsigned char c = 0;
char ch = 0;
unsigned char num_chars = 0, num_bs = 0;
-
+
tail = ldata->echo_tail;
while (ldata->echo_commit != tail)
{
@@ -1126,7 +1126,19 @@ static int n_tty_open(struct dfs_fd *fd)
}
ldata->atomic_read_lock = rt_mutex_create("atomic_read_lock",RT_IPC_FLAG_FIFO);
+ if(ldata->atomic_read_lock == RT_NULL)
+ {
+ LOG_E("n_tty_open atomic_read_lock create fail");
+ return -1;
+ }
+
ldata->output_lock = rt_mutex_create("output_lock",RT_IPC_FLAG_FIFO);
+ if(ldata->output_lock == RT_NULL)
+ {
+ LOG_E("n_tty_open output_lock create fail");
+ return -1;
+ }
+
tty->disc_data = ldata;
reset_buffer_flags(ldata);
ldata->column = 0;