jlaitine commented on a change in pull request #5161:
URL: https://github.com/apache/incubator-nuttx/pull/5161#discussion_r778394798
##########
File path: arch/risc-v/src/mpfs/mpfs_serial.c
##########
@@ -907,10 +907,28 @@ static int up_ioctl(struct file *filep, int cmd, unsigned
long arg)
priv->stopbits2 = (termiosp->c_cflag & CSTOPB) != 0;
- priv->bits = (termiosp->c_cflag & CS5) ? 5 : 0;
- priv->bits = (termiosp->c_cflag & CS6) ? 6 : 0;
- priv->bits = (termiosp->c_cflag & CS7) ? 7 : 0;
- priv->bits = (termiosp->c_cflag & CS8) ? 8 : 0;
+ switch (termiosp->c_cflag & CSIZE)
+ {
+ case CS5:
+ priv->bits = 5;
+ break;
+
+ case CS6:
+ priv->bits = 6;
+ break;
+
+ case CS7:
+ priv->bits = 7;
+ break;
+
+ case CS8:
+ priv->bits = 8;
+ break;
+
+ default:
+ priv->bits = 0;
+ ret = -EINVAL;
Review comment:
sure
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]