diff --git a/components/drivers/sdio/mmc.c b/components/drivers/sdio/mmc.c index 0a41eee594f7e801e01f55f7379012ee3bfd19aa..e3e09d8bccf58145f4a799c75766e1d235cc24d2 100644 --- a/components/drivers/sdio/mmc.c +++ b/components/drivers/sdio/mmc.c @@ -321,12 +321,15 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) * bail out early if corresponding bus capable wasn't * set by drivers. */ - if ((!(host->flags & MMCSD_BUSWIDTH_8) && + + if (!(((host->flags & MMCSD_BUSWIDTH_8) && ext_csd_bits[idx] == EXT_CSD_BUS_WIDTH_8) || - (!(host->flags & MMCSD_BUSWIDTH_4) && - (ext_csd_bits[idx] == EXT_CSD_BUS_WIDTH_4 || - ext_csd_bits[idx] == EXT_CSD_BUS_WIDTH_8))) - continue; + ((host->flags & MMCSD_BUSWIDTH_4) && + ext_csd_bits[idx] == EXT_CSD_BUS_WIDTH_4) || + !(ext_csd_bits[idx] == EXT_CSD_BUS_WIDTH_8))) + { + continue; + } err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, diff --git a/components/drivers/tty/n_tty.c b/components/drivers/tty/n_tty.c index f44f0cdf8fe551e35d2fd2e9b4d4f5f93492dec2..38bfd9006062e31ccf5bbd73775ee3ee2d1eebe3 100644 --- a/components/drivers/tty/n_tty.c +++ b/components/drivers/tty/n_tty.c @@ -791,7 +791,8 @@ static size_t __process_echoes(struct tty_struct *tty) size_t tail = 0; unsigned char c = 0; char ch = 0; - + unsigned char num_chars = 0, num_bs = 0; + tail = ldata->echo_tail; while (ldata->echo_commit != tail) { @@ -809,8 +810,6 @@ static size_t __process_echoes(struct tty_struct *tty) switch (op) { - unsigned char num_chars = 0, num_bs = 0; - case ECHO_OP_ERASE_TAB: num_chars = echo_buf(ldata, tail + 2); @@ -1846,6 +1845,7 @@ static int n_tty_read(struct dfs_fd *fd, void *buf, size_t count) c = job_control(tty); if (c < 0) { + rt_hw_interrupt_enable(level); return c; } diff --git a/components/drivers/tty/pty.c b/components/drivers/tty/pty.c index 2c147b21c20ccc5650f19b1830e8ff167c36884b..7233c1756616fdb7a84c035170f6c6024d4357ee 100644 --- a/components/drivers/tty/pty.c +++ b/components/drivers/tty/pty.c @@ -308,8 +308,7 @@ static int ptmx_register(void) level = rt_hw_interrupt_disable(); RT_ASSERT(ptm_drv->init_flag == TTY_INIT_FLAG_NONE); - - level = rt_hw_interrupt_disable(); + device = &(ptm_drv->parent); device->type = RT_Device_Class_Char; diff --git a/components/drivers/tty/tty.c b/components/drivers/tty/tty.c index b88a4b700f62cb71bbe08a00d1162b51befcdd23..6ba733f778562d63a47590d81064ed8053090eb4 100644 --- a/components/drivers/tty/tty.c +++ b/components/drivers/tty/tty.c @@ -79,11 +79,13 @@ int __tty_check_change(struct tty_struct *tty, int sig) level = rt_hw_interrupt_disable(); if (current == RT_NULL) { + rt_hw_interrupt_enable(level); return 0; } if (current->tty != tty) { + rt_hw_interrupt_enable(level); return 0; }