public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Paul Bolle <pebolle@tiscali.nl>
Cc: dhowells@redhat.com, akpm@linux-foundation.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tomas Winkler <tomas.winkler@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mei: mei-amt-version: remove unneeded call of mei_deinit()
Date: Fri, 03 Jan 2014 17:14:59 +0000	[thread overview]
Message-ID: <25291.1388769299@warthog.procyon.org.uk> (raw)
In-Reply-To: <1388769034.20141.11.camel@x220>

Paul Bolle <pebolle@tiscali.nl> wrote:

> From: Paul Bolle <pebolle@tiscali.nl>
> 
> Building mei-amt-version.o triggers a GCC 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;
>                          ^
> 
> GCC is correct. See, the call chain that GCC detects must be
>     main()
>         amt_host_if_init()
>             mei_init()
>                 mei_deinit()
> 
> But when we enter mei_deinit() struct amt_host_if acmd is still
> unitialized. That makes the test for (effectively) amt_host_if->mei_cl->fd
> bogus.
> 
> But it turns out that call of mei_deinit() isn't needed at all. All of
> the members of mei_cl will be set later in mei_init() and none will be
> used before they are set. So we can simply drop this call of
> mei_deinit().
> 
> Signed-off-by: Paul Bolle <pebolle@tiscali.nl>

Builds without warning for me.

Acked-by: David Howells <dhowells@redhat.com>

  reply	other threads:[~2014-01-03 17:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-03 16:08 [PATCH 7/7] Fix uninitialised variable warning in mei-amt-version.c David Howells
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 [this message]
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=25291.1388769299@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --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