From: Andy Shevchenko <andriy.shevche...@linux.intel.com>

Backport:
 - Upstream-Status: Pending.
 
[https://bitbucket.org/andy-shev/linux/commits/15c1b8590c648ee0b1b747b30d285725424044de?at=master]

upf_t is a bitwise defined type and any assignment from different, but
compatible, types makes static analyzer unhappy.

drivers/tty/serial/serial_core.c:793:29: warning: incorrect type in assignment 
(different base types)
drivers/tty/serial/serial_core.c:793:29:    expected int [signed] flags
drivers/tty/serial/serial_core.c:793:29:    got restricted upf_t [usertype] 
flags
drivers/tty/serial/serial_core.c:867:19: warning: incorrect type in assignment 
(different base types)
drivers/tty/serial/serial_core.c:867:19:    expected restricted upf_t 
[usertype] new_flags
drivers/tty/serial/serial_core.c:867:19:    got int [signed] flags

Enforce corresponding types when upf_t being assigned.

Signed-off-by: Andy Shevchenko <andriy.shevche...@linux.intel.com>
---
 drivers/tty/serial/serial_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index def5199..84c26d5 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -691,7 +691,7 @@ static void do_uart_get_info(struct tty_port *port,
        if (HIGH_BITS_OFFSET)
                retinfo->port_high = (long) uport->iobase >> HIGH_BITS_OFFSET;
        retinfo->irq                = uport->irq;
-       retinfo->flags      = uport->flags;
+       retinfo->flags      = (__force int)uport->flags;
        retinfo->xmit_fifo_size  = uport->fifosize;
        retinfo->baud_base          = uport->uartclk / 16;
        retinfo->close_delay        = jiffies_to_msecs(port->close_delay) / 10;
@@ -765,7 +765,7 @@ static int uart_set_info(struct tty_struct *tty, struct 
tty_port *port,
                    new_info->type != uport->type);
 
        old_flags = uport->flags;
-       new_flags = new_info->flags;
+       new_flags = (__force upf_t)new_info->flags;
        old_custom_divisor = uport->custom_divisor;
 
        if (!capable(CAP_SYS_ADMIN)) {
-- 
1.9.1

-- 
_______________________________________________
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to