From: Arnd Bergmann <arnd@arndb.de>
To: David Lin <dtwlin@gmail.com>, Johan Hovold <johan@kernel.org>,
Alex Elder <elder@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Axel Haslam <ahaslam@baylibre.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Johan Hovold <johan@hovoldconsulting.com>,
Greg Kroah-Hartman <gregkh@google.com>,
Mark Greer <mgreer@animalcreek.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] greybus: uart: fix uninitialized flow control variable
Date: Wed, 29 Apr 2020 21:00:09 +0200 [thread overview]
Message-ID: <20200429190022.12671-1-arnd@arndb.de> (raw)
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@arndb.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
next reply other threads:[~2020-04-29 19:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 19:00 Arnd Bergmann [this message]
2020-04-29 20:00 ` [greybus-dev] [PATCH] greybus: uart: fix uninitialized flow control variable Alex Elder
2020-05-14 7:04 ` Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200429190022.12671-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=ahaslam@baylibre.com \
--cc=devel@driverdev.osuosl.org \
--cc=dtwlin@gmail.com \
--cc=elder@kernel.org \
--cc=gregkh@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@hovoldconsulting.com \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgreer@animalcreek.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox