From: Daniel Thompson <daniel.thompson@linaro.org>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>,
David Brown <davidb@codeaurora.org>,
Daniel Walker <dwalker@fifo99.com>
Cc: Bryan Huntsman <bryanh@codeaurora.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>,
Grant Likely <grant.likely@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH] tty: serial: msm_serial.c: Cleaning up uninitialized variables
Date: Mon, 02 Jun 2014 11:15:28 +0100 [thread overview]
Message-ID: <538C4EC0.6090300@linaro.org> (raw)
In-Reply-To: <1401629904-19492-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
On 01/06/14 14:38, Rickard Strandqvist wrote:
> There is a risk that the variable will be used without being initialized.
>
> This was largely found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
> drivers/tty/serial/msm_serial.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
> index 053b98e..c67f5c5 100644
> --- a/drivers/tty/serial/msm_serial.c
> +++ b/drivers/tty/serial/msm_serial.c
> @@ -962,7 +962,7 @@ static int __init msm_console_setup(struct console *co, char *options)
> {
> struct uart_port *port;
> struct msm_port *msm_port;
> - int baud, flow, bits, parity;
> + int baud = 0, flow, bits, parity;
This made me wonder my "baud" is special compared to the other three
variables. In fact I don't really think it is special so setting "baud"
from the else clause in the uninitialized branch makes more sense to me.
next prev parent reply other threads:[~2014-06-02 10:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-01 13:38 [PATCH] tty: serial: msm_serial.c: Cleaning up uninitialized variables Rickard Strandqvist
2014-06-02 10:15 ` Daniel Thompson [this message]
2014-06-02 23:15 ` dwalker
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=538C4EC0.6090300@linaro.org \
--to=daniel.thompson@linaro.org \
--cc=bryanh@codeaurora.org \
--cc=davidb@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=dwalker@fifo99.com \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=rickard_strandqvist@spectrumdigital.se \
--cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).