[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200429190022.12671-1-arnd@arndb.de>
Date: Wed, 29 Apr 2020 21:00:09 +0200
From: Arnd Bergmann <arnd@...db.de>
To: David Lin <dtwlin@...il.com>, Johan Hovold <johan@...nel.org>,
Alex Elder <elder@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Axel Haslam <ahaslam@...libre.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Johan Hovold <johan@...oldconsulting.com>,
Greg Kroah-Hartman <gregkh@...gle.com>,
Mark Greer <mgreer@...malcreek.com>,
Viresh Kumar <viresh.kumar@...aro.org>,
greybus-dev@...ts.linaro.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] greybus: uart: fix uninitialized flow control variable
gcc-10 points out an uninitialized variable use:
drivers/staging/greybus/uart.c: In function 'gb_tty_set_termios':
drivers/staging/greybus/uart.c:540:24: error: 'newline.flow_control' is used uninitialized in this function [-Werror=uninitialized]
540 | newline.flow_control |= GB_SERIAL_AUTO_RTSCTS_EN;
Instead of using |= and &= on the uninitialized variable, use a
direct assignment.
Fixes: e55c25206d5c ("greybus: uart: Handle CRTSCTS flag in termios")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
drivers/staging/greybus/uart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
index 55c51143bb09..4ffb334cd5cd 100644
--- a/drivers/staging/greybus/uart.c
+++ b/drivers/staging/greybus/uart.c
@@ -537,9 +537,9 @@ static void gb_tty_set_termios(struct tty_struct *tty,
}
if (C_CRTSCTS(tty) && C_BAUD(tty) != B0)
- newline.flow_control |= GB_SERIAL_AUTO_RTSCTS_EN;
+ newline.flow_control = GB_SERIAL_AUTO_RTSCTS_EN;
else
- newline.flow_control &= ~GB_SERIAL_AUTO_RTSCTS_EN;
+ newline.flow_control = 0;
if (memcmp(&gb_tty->line_coding, &newline, sizeof(newline))) {
memcpy(&gb_tty->line_coding, &newline, sizeof(newline));
--
2.26.0
Powered by blists - more mailing lists