Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: serial: qcom_geni_serial: Initialize baud in qcom_geni_console_setup

When building with -Wsometimes-uninitialized, Clang warns:

drivers/tty/serial/qcom_geni_serial.c:1079:6: warning: variable 'baud'
is used uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]

It's not wrong; when options is NULL, baud has no default value. Use
9600 as that is a sane default.

Link: https://github.com/ClangBuiltLinux/linux/issues/395
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Nathan Chancellor and committed by
Greg Kroah-Hartman
c5cbc78a ac0cdb3d

+1 -1
+1 -1
drivers/tty/serial/qcom_geni_serial.c
··· 1050 1050 { 1051 1051 struct uart_port *uport; 1052 1052 struct qcom_geni_serial_port *port; 1053 - int baud; 1053 + int baud = 9600; 1054 1054 int bits = 8; 1055 1055 int parity = 'n'; 1056 1056 int flow = 'n';