You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/02/08 05:31:43 UTC

[nuttx] 02/02: serial: Fix a warning if termios enabled

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit b250db5dba49db7d55bcb87a19ea2ed11aa976cf
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Wed Feb 8 11:27:44 2023 +0800

    serial: Fix a warning if termios enabled
    
    Fix:
    ```
     serial/serial.c: In function 'uart_ioctl':
    Error: serial/serial.c:1397:46: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
     1397 |               FAR struct termios *termiosp = (FAR struct termios *)arg;
          |                                              ^
    Error: serial/serial.c:1419:46: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
     1419 |               FAR struct termios *termiosp = (FAR struct termios *)arg;
          |
    ```
    
    Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
 drivers/serial/serial.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index cbb81e94cb..4d053060d7 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -1395,7 +1395,8 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
         {
           case TCGETS:
             {
-              FAR struct termios *termiosp = (FAR struct termios *)arg;
+              FAR struct termios *termiosp = (FAR struct termios *)
+                                                (uintptr_t)arg;
 
               if (!termiosp)
                 {
@@ -1415,7 +1416,8 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
 
           case TCSETS:
             {
-              FAR struct termios *termiosp = (FAR struct termios *)arg;
+              FAR struct termios *termiosp = (FAR struct termios *)
+                                                (uintptr_t)arg;
 
               if (!termiosp)
                 {