mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: akpm@linux-foundation.org
Cc: dhowells@redhat.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tomas Winkler <tomas.winkler@intel.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 7/7] Fix uninitialised variable warning in mei-amt-version.c
Date: Fri, 03 Jan 2014 16:08:12 +0000	[thread overview]
Message-ID: <20140103160812.8153.74401.stgit@warthog.procyon.org.uk> (raw)

Fix the following warning:

	Documentation/misc-devices/mei/mei-amt-version.c: In function 'main':
	Documentation/misc-devices/mei/mei-amt-version.c:103:5: warning: 'acmd.fd' is used uninitialized in this function [-Wuninitialized]
	  if (cl->fd != -1)
	     ^
	Documentation/misc-devices/mei/mei-amt-version.c:443:21: note: 'acmd.fd' was declared here
	  struct amt_host_if acmd;
			     ^

The call chain:

	-->main()
	   -->amt_host_if_init()
	      -->mei_init()
	         -->mei_deinit()

results in this on the first time through because main()::acmd has not yet
been initialised.

To fix this, acmd.fd needs to be initialised to -1.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Tomas Winkler <tomas.winkler@intel.com>
cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

 Documentation/misc-devices/mei/mei-amt-version.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/misc-devices/mei/mei-amt-version.c b/Documentation/misc-devices/mei/mei-amt-version.c
index 49e4f770864a..7027a8da0ba0 100644
--- a/Documentation/misc-devices/mei/mei-amt-version.c
+++ b/Documentation/misc-devices/mei/mei-amt-version.c
@@ -440,7 +440,7 @@ out:
 int main(int argc, char **argv)
 {
 	struct amt_code_versions ver;
-	struct amt_host_if acmd;
+	struct amt_host_if acmd = { .mei_cl.fd = -1 };
 	unsigned int i;
 	uint32_t status;
 	int ret;


             reply	other threads:[~2014-01-03 16:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-03 16:08 David Howells [this message]
2014-01-03 16:23 ` Paul Bolle
2014-01-03 16:34 ` David Howells
2014-01-03 17:10   ` [PATCH] mei: mei-amt-version: remove unneeded call of mei_deinit() Paul Bolle
2014-01-03 17:14   ` David Howells
2014-01-04 21:24   ` [PATCH 7/7] Fix uninitialised variable warning in mei-amt-version.c Winkler, Tomas

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=20140103160812.8153.74401.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomas.winkler@intel.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®