[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150602132403.GB6826@codeblueprint.co.uk>
Date: Tue, 2 Jun 2015 14:24:03 +0100
From: Matt Fleming <matt@...eblueprint.co.uk>
To: Ingo Molnar <mingo@...nel.org>
Cc: "H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
Peter Jones <pjones@...hat.com>
Subject: Re: [GIT PULL] EFI changes for v4.2
On Tue, 02 Jun, at 08:45:57AM, Ingo Molnar wrote:
>
> Pulled, thanks a lot Matt!
>
> I'm wondering about this commit:
>
> f2f6b587c553 ("efi/esrt: Fix some compiler warnings")
>
> It says, in part:
>
> This patch also fixes one other warning about an uninitialized variable
> some compiler versions seem to see. You can't actually hit the code
> path where it would be uninitialized, because there's a prior test that
> would error out, but gcc hasn't figured that out. Anyway, it now has a
> test and returns the error at both places.
>
> @@ -167,7 +167,6 @@ static struct kset *esrt_kset;
>
> static int esre_create_sysfs_entry(void *esre, int entry_num)
> {
> - int rc = 0;
> struct esre_entry *entry;
> char name[20];
>
> @@ -180,13 +179,15 @@ static int esre_create_sysfs_entry(void *esre, int entry_num)
> entry->kobj.kset = esrt_kset;
>
> if (esrt->fw_resource_version == 1) {
> + int rc = 0;
> +
> entry->esre.esre1 = esre;
> rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL,
> "%s", name);
> - }
> - if (rc) {
> - kfree(entry);
> - return rc;
> + if (rc) {
> + kfree(entry);
> + return rc;
> + }
> }
>
> list_add_tail(&entry->list, &entry_list);
>
> How can a compiler ever have warned about 'rc' being uninitialized? It's defined
> straight at function entry, with initialization to 0. It can never be
> uninitialized.
Hmm... yeah good point. I admit that I missed that when merging this
patch because I was focusing more on the fix for the kbuild warnings
related to phys_addr_t.
Peter? Where did you see gcc complaining about this?
--
Matt Fleming, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists