diff options
| author | lessone1 <[email protected]> | 2023-04-14 21:01:32 +0800 |
|---|---|---|
| committer | Man, Jianting (Meco) <[email protected]> | 2023-04-14 22:51:06 -0400 |
| commit | 2638a2a90ce544cdb9892be943bfd51ea362b936 (patch) | |
| tree | 52c6e60b5240913eadd6b032361ed1f7b89167ca /components | |
| parent | 2c98ce4605515910025212a85b2f776129a0981c (diff) | |
[components] Wrong order of judgment
Diffstat (limited to 'components')
| -rw-r--r-- | components/drivers/serial/serial.c | 4 | ||||
| -rw-r--r-- | components/drivers/serial/serial_v2.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index 1d78140015..0617652c04 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -1204,12 +1204,12 @@ static rt_err_t rt_serial_control(struct rt_device *dev, rt_memset(row_s,0,4); rt_memset(col_s,0,4); cnt1 = 0; - while(_tio_buf[cnt1] != ';' && cnt1 < _TIO_BUFLEN) + while(cnt1 < _TIO_BUFLEN && _tio_buf[cnt1] != ';') { cnt1++; } cnt2 = ++cnt1; - while(_tio_buf[cnt2] != ';' && cnt2 < _TIO_BUFLEN) + while(cnt2 < _TIO_BUFLEN && _tio_buf[cnt2] != ';') { cnt2++; } diff --git a/components/drivers/serial/serial_v2.c b/components/drivers/serial/serial_v2.c index 68f9068601..60d7a149fd 100644 --- a/components/drivers/serial/serial_v2.c +++ b/components/drivers/serial/serial_v2.c @@ -1316,12 +1316,12 @@ static rt_err_t rt_serial_control(struct rt_device *dev, rt_memset(row_s,0,4); rt_memset(col_s,0,4); cnt1 = 0; - while(_tio_buf[cnt1] != ';' && cnt1 < _TIO_BUFLEN) + while(cnt1 < _TIO_BUFLEN && _tio_buf[cnt1] != ';') { cnt1++; } cnt2 = ++cnt1; - while(_tio_buf[cnt2] != ';' && cnt2 < _TIO_BUFLEN) + while(cnt2 < _TIO_BUFLEN && _tio_buf[cnt2] != ';') { cnt2++; } |
