All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RT] tty: serial: pl011: fix warning about uninitialized variable
@ 2018-09-24  8:29 Kurt Kanzenbach
  2018-10-05 14:35 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 2+ messages in thread
From: Kurt Kanzenbach @ 2018-09-24  8:29 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: linux-kernel, linux-rt-users, Kurt Kanzenbach

Silence the following gcc warning:

drivers/tty/serial/amba-pl011.c: In function ‘pl011_console_write’:
./include/linux/spinlock.h:260:3: warning: ‘flags’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   _raw_spin_unlock_irqrestore(lock, flags); \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/amba-pl011.c:2214:16: note: ‘flags’ was declared here
  unsigned long flags;
                ^~~~~

The code is correct. Thus, initializing flags to zero doesn't change the
behavior and resolves the warning.

Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 drivers/tty/serial/amba-pl011.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 484861278e9c..a658214486e7 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2211,7 +2211,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
 {
 	struct uart_amba_port *uap = amba_ports[co->index];
 	unsigned int old_cr = 0, new_cr;
-	unsigned long flags;
+	unsigned long flags = 0;
 	int locked = 1;
 
 	clk_enable(uap->clk);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RT] tty: serial: pl011: fix warning about uninitialized variable
  2018-09-24  8:29 [PATCH RT] tty: serial: pl011: fix warning about uninitialized variable Kurt Kanzenbach
@ 2018-10-05 14:35 ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-10-05 14:35 UTC (permalink / raw)
  To: Kurt Kanzenbach; +Cc: linux-kernel, linux-rt-users

On 2018-09-24 10:29:01 [+0200], Kurt Kanzenbach wrote:
> Silence the following gcc warning:
> 
> drivers/tty/serial/amba-pl011.c: In function ‘pl011_console_write’:
> ./include/linux/spinlock.h:260:3: warning: ‘flags’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    _raw_spin_unlock_irqrestore(lock, flags); \
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/tty/serial/amba-pl011.c:2214:16: note: ‘flags’ was declared here
>   unsigned long flags;
>                 ^~~~~
> 
> The code is correct. Thus, initializing flags to zero doesn't change the
> behavior and resolves the warning.
> 
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>

applied.

Sebastian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-05 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-24  8:29 [PATCH RT] tty: serial: pl011: fix warning about uninitialized variable Kurt Kanzenbach
2018-10-05 14:35 ` Sebastian Andrzej Siewior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.