mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Soren Brinkmann <soren.brinkmann@xilinx.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.cz>,
	Michal Simek <michal.simek@xilinx.com>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	Soren Brinkmann <soren.brinkmann@xilinx.com>
Subject: [PATCH 1/3] tty: xuartps: Fix "may be used uninitialized" build warning
Date: Mon, 21 Oct 2013 16:40:59 -0700	[thread overview]
Message-ID: <1382398861-21542-2-git-send-email-soren.brinkmann@xilinx.com> (raw)
In-Reply-To: <1382398861-21542-1-git-send-email-soren.brinkmann@xilinx.com>

Initialize varibles for which a 'may be used uninitalized' warning is
issued.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
The warning is actually a false positive. The variables are passed to a
function per reference. That function uses those variables to return
values, which then are used by the caller. Is there a way to
avoid the initialization and the build warning alltogether?
---
 drivers/tty/serial/xilinx_uartps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index c7c96c2f149c..5ac6c480df43 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -389,7 +389,7 @@ static unsigned int xuartps_set_baud_rate(struct uart_port *port,
 		unsigned int baud)
 {
 	unsigned int calc_baud;
-	u32 cd, bdiv;
+	u32 cd = 0, bdiv = 0;
 	u32 mreg;
 	int div8;
 	struct xuartps *xuartps = port->private_data;
-- 
1.8.4.1


  reply	other threads:[~2013-10-21 23:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21 23:40 [PATCH 0/3] tty: xuartps: Fix build Soren Brinkmann
2013-10-21 23:40 ` Soren Brinkmann [this message]
2013-10-29 16:22   ` [PATCH 1/3] tty: xuartps: Fix "may be used uninitialized" build warning Greg Kroah-Hartman
2013-10-29 16:39     ` Sören Brinkmann
2013-10-21 23:41 ` [PATCH 2/3] tty: xuartps: Fix build error due to missing forward declaration Soren Brinkmann
2013-10-21 23:41 ` [PATCH 3/3] tty: xuartps: Fix build error when COMMON_CLK is not set Soren Brinkmann
2013-10-29 16:24 ` [PATCH 0/3] tty: xuartps: Fix build Greg Kroah-Hartman
2013-10-29 16:26   ` Greg Kroah-Hartman

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=1382398861-21542-2-git-send-email-soren.brinkmann@xilinx.com \
    --to=soren.brinkmann@xilinx.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    /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

all inboxes | Powered by JetHome®