lkml.org 
[lkml]   [2022]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[l1k:smsc95xx_5.17 16/201] drivers/tty/serial/8250/8250_fsl.c:59:17: warning: Local variable 'flags' shadows outer variable [shadowVariable]
tree:   https://github.com/l1k/linux smsc95xx_5.17
head: 05d68ced287b30f62f18f95b5476135ef669804a
commit: 02cdb90be8f210b57f5068d5e73aeb71e74a9380 [16/201] serial: 8250: implement write_atomic
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout 02cdb90be8f210b57f5068d5e73aeb71e74a9380
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck warnings: (new ones prefixed by >>)
>> drivers/tty/serial/8250/8250_fsl.c:59:17: warning: Local variable 'flags' shadows outer variable [shadowVariable]
unsigned long flags;
^
drivers/tty/serial/8250/8250_fsl.c:29:16: note: Shadowed declaration
unsigned long flags;
^
drivers/tty/serial/8250/8250_fsl.c:59:17: note: Shadow variable
unsigned long flags;
^

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

drivers/tty/serial/serial_mctrl_gpio.h:102:70: warning: Parameter 'mctrl' can be declared with const [constParameter]
unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl)
^
drivers/tty/serial/serial_mctrl_gpio.h:108:65: warning: Parameter 'mctrl' can be declared with const [constParameter]
mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl)
^

vim +/flags +59 drivers/tty/serial/8250/8250_fsl.c

25
26 int fsl8250_handle_irq(struct uart_port *port)
27 {
28 unsigned char lsr, orig_lsr;
29 unsigned long flags;
30 unsigned int iir;
31 struct uart_8250_port *up = up_to_u8250p(port);
32
33 spin_lock_irqsave(&up->port.lock, flags);
34
35 iir = port->serial_in(port, UART_IIR);
36 if (iir & UART_IIR_NO_INT) {
37 spin_unlock(&up->port.lock);
38 return 0;
39 }
40
41 /* This is the WAR; if last event was BRK, then read and return */
42 if (unlikely(up->lsr_saved_flags & UART_LSR_BI)) {
43 up->lsr_saved_flags &= ~UART_LSR_BI;
44 port->serial_in(port, UART_RX);
45 spin_unlock(&up->port.lock);
46 return 1;
47 }
48
49 lsr = orig_lsr = up->port.serial_in(&up->port, UART_LSR);
50
51 /* Process incoming characters first */
52 if ((lsr & (UART_LSR_DR | UART_LSR_BI)) &&
53 (up->ier & (UART_IER_RLSI | UART_IER_RDI))) {
54 lsr = serial8250_rx_chars(up, lsr);
55 }
56
57 /* Stop processing interrupts on input overrun */
58 if ((orig_lsr & UART_LSR_OE) && (up->overrun_backoff_time_ms > 0)) {
> 59 unsigned long flags;
60 unsigned long delay;
61 bool is_console;
62
63 is_console = uart_console(port);
64
65 if (is_console)
66 printk_cpu_sync_get_irqsave(flags);
67 up->ier = port->serial_in(port, UART_IER);
68 if (is_console)
69 printk_cpu_sync_put_irqrestore(flags);
70
71 if (up->ier & (UART_IER_RLSI | UART_IER_RDI)) {
72 port->ops->stop_rx(port);
73 } else {
74 /* Keep restarting the timer until
75 * the input overrun subsides.
76 */
77 cancel_delayed_work(&up->overrun_backoff);
78 }
79
80 delay = msecs_to_jiffies(up->overrun_backoff_time_ms);
81 schedule_delayed_work(&up->overrun_backoff, delay);
82 }
83
84 serial8250_modem_status(up);
85
86 if ((lsr & UART_LSR_THRE) && (up->ier & UART_IER_THRI))
87 serial8250_tx_chars(up);
88
89 up->lsr_saved_flags = orig_lsr;
90
91 uart_unlock_and_check_sysrq_irqrestore(&up->port, flags);
92
93 return 1;
94 }
95 EXPORT_SYMBOL_GPL(fsl8250_handle_irq);
96

--
0-DAY CI Kernel Test Service
https://01.org/lkp

\
 
 \ /
  Last update: 2022-04-08 21:09    [W:0.530 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site