From: Daniel Vetter <daniel@ffwll.ch>
To: Pavel Machek <pavel@ucw.cz>
Cc: airlied@linux.ie, daniel.vetter@ffwll.ch,
intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] work around warning in i915_gem_gtt
Date: Mon, 28 Jul 2014 17:24:48 +0200 [thread overview]
Message-ID: <20140728152448.GD4747@phenom.ffwll.local> (raw)
In-Reply-To: <20140728112058.GA17504@amd.pavel.ucw.cz>
On Mon, Jul 28, 2014 at 01:20:58PM +0200, Pavel Machek wrote:
>
> Gcc warns that addr might be used uninitialized. It may not, but I see
> why gcc gets confused.
>
> Additionally, hiding code with side-effects inside WARN_ON() argument
> seems uncool, so I moved it outside.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 8b3cde7..8fcc974 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1448,7 +1448,7 @@ static void gen6_ggtt_insert_entries(struct i915_address_space *vm,
> (gen6_gtt_pte_t __iomem *)dev_priv->gtt.gsm + first_entry;
> int i = 0;
> struct sg_page_iter sg_iter;
> - dma_addr_t addr;
> + dma_addr_t addr = 0;
I want to have a /* shuts up gcc */ for these kinds of things, where we
need to help out the compiler. Added and merged, thanks.
-Daniel
>
> for_each_sg_page(st->sgl, &sg_iter, st->nents, 0) {
> addr = sg_page_iter_dma_address(&sg_iter);
> @@ -1462,9 +1462,10 @@ static void gen6_ggtt_insert_entries(struct i915_address_space *vm,
> * of NUMA access patterns. Therefore, even with the way we assume
> * hardware should work, we must keep this posting read for paranoia.
> */
> - if (i != 0)
> - WARN_ON(readl(>t_entries[i-1]) !=
> - vm->pte_encode(addr, level, true));
> + if (i != 0) {
> + unsigned long gtt = readl(>t_entries[i-1]);
> + WARN_ON(gtt != vm->pte_encode(addr, level, true));
> + }
>
> /* This next bit makes the above posting read even more important. We
> * want to flush the TLBs only after we're certain all the PTE updates
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
prev parent reply other threads:[~2014-07-28 15:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-28 11:20 [PATCH] work around warning in i915_gem_gtt Pavel Machek
2014-07-28 15:24 ` Daniel Vetter [this message]
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=20140728152448.GD4747@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
/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