From: Marek Vasut <marek.vasut@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: ichxrom: maybe-uninitialized with gcc-4.9
Date: Mon, 24 Oct 2016 22:47:59 +0200 [thread overview]
Message-ID: <470c5483-949c-6e2a-cd52-73d99748b312@gmail.com> (raw)
In-Reply-To: <20161024152853.2673518-1-arnd@arndb.de>
On 10/24/2016 05:28 PM, Arnd Bergmann wrote:
> pci_read_config_word() might fail and not initialize its output,
> as pointed out by older versions of gcc when using the -Wmaybe-unintialized
> flag:
>
> drivers/mtd/maps/ichxrom.c: In function ‘ichxrom_cleanup’:
> drivers/mtd/maps/ichxrom.c:63:2: error: ‘word’ is used uninitialized in this function [-Werror=uninitialized]
>
> This is apparently a correct warning, though it does not show up
> with newer compilers. Changing the code to not attempt to write
> back uninitialized data into PCI config space is a correct
> fix for the problem and avoids the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Marek Vasut <marex@denx.de>
> ---
> drivers/mtd/maps/ichxrom.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c
> index e17d02ae03f0..976d42f63aef 100644
> --- a/drivers/mtd/maps/ichxrom.c
> +++ b/drivers/mtd/maps/ichxrom.c
> @@ -57,10 +57,12 @@ static void ichxrom_cleanup(struct ichxrom_window *window)
> {
> struct ichxrom_map_info *map, *scratch;
> u16 word;
> + int ret;
>
> /* Disable writes through the rom window */
> - pci_read_config_word(window->pdev, BIOS_CNTL, &word);
> - pci_write_config_word(window->pdev, BIOS_CNTL, word & ~1);
> + ret = pci_read_config_word(window->pdev, BIOS_CNTL, &word);
> + if (!ret)
> + pci_write_config_word(window->pdev, BIOS_CNTL, word & ~1);
> pci_dev_put(window->pdev);
>
> /* Free all of the mtd devices */
>
--
Best regards,
Marek Vasut
next prev parent reply other threads:[~2016-10-24 20:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 15:28 Arnd Bergmann
2016-10-24 20:47 ` Marek Vasut [this message]
2017-02-08 22:17 ` Brian Norris
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=470c5483-949c-6e2a-cd52-73d99748b312@gmail.com \
--to=marek.vasut@gmail.com \
--cc=arnd@arndb.de \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.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
all inboxes | Powered by JetHome®