All of lore.kernel.org
 help / color / mirror / Atom feed
* -Wsometimes-uninitialized Clang warning in drivers/tty/serial/qcom_geni_serial.c
@ 2019-03-08  0:45 Nathan Chancellor
  2019-03-08  8:40 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Nathan Chancellor @ 2019-03-08  0:45 UTC (permalink / raw)
  To: Andy Gross, David Brown, Greg Kroah-Hartman,
	Karthikeyan Ramasubramanian, Douglas Anderson, Ryan Case
  Cc: linux-arm-msm, linux-serial, linux-kernel, Nick Desaulniers,
	clang-built-linux

Hi all,

We are trying to get Clang's -Wsometimes-uninitialized turned on for the
kernel as it can catch some bugs that GCC can't. This warning came up:

drivers/tty/serial/qcom_geni_serial.c:1079:6: warning: variable 'baud' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        if (options)
            ^~~~~~~
drivers/tty/serial/qcom_geni_serial.c:1082:37: note: uninitialized use occurs here
        return uart_set_options(uport, co, baud, parity, bits, flow);
                                           ^~~~
drivers/tty/serial/qcom_geni_serial.c:1079:2: note: remove the 'if' if its condition is always true
        if (options)
        ^~~~~~~~~~~~
drivers/tty/serial/qcom_geni_serial.c:1053:10: note: initialize the variable 'baud' to silence this warning
        int baud;
                ^
                 = 0
1 warning generated.

While this is probably not an issue in practice (I assume baud is always
supplied as an option), we should clean up this warning. I would fix it
myself but I have no idea what baud's initial value should be as it
seems it is dependent on the driver. Your input would be much
appreciated.

Cheers,
Nathan

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

end of thread, other threads:[~2019-03-22 18:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08  0:45 -Wsometimes-uninitialized Clang warning in drivers/tty/serial/qcom_geni_serial.c Nathan Chancellor
2019-03-08  8:40 ` Greg Kroah-Hartman
2019-03-08 18:37   ` [PATCH] tty: serial: qcom_geni_serial: Initialize baud in qcom_geni_console_setup Nathan Chancellor
2019-03-08 18:40     ` Nick Desaulniers
2019-03-22 14:20     ` Arnd Bergmann
2019-03-22 18:04       ` Nick Desaulniers

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.