From: Zhenyu Wang <zhenyuw@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/3] agp/intel: Destroy the scatterlist on allocation failure
Date: Tue, 27 Jul 2010 10:00:07 +0800 [thread overview]
Message-ID: <20100727020007.GC19248@zhen-devel.sh.intel.com> (raw)
In-Reply-To: <1279992577-31841-3-git-send-email-chris@chris-wilson.co.uk>
[-- Attachment #1.1: Type: text/plain, Size: 1893 bytes --]
On 2010.07.24 18:29:37 +0100, Chris Wilson wrote:
> A side-effect of being able to use custom page allocations with the
> sg_table is that it cannot reap the partially constructed scatterlist if
> fails to allocate a page. So we need to call sg_free_table() ourselves
> if sg_alloc_table() fails.
Why? Doesn't sg_alloc_table() handle the failure case to call sg_free_table()
already?
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc Dave Airlie <airlied@redhat.com>
> ---
> drivers/char/agp/intel-gtt.c | 13 ++++++++-----
> 1 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
> index f97122a..5615d70 100644
> --- a/drivers/char/agp/intel-gtt.c
> +++ b/drivers/char/agp/intel-gtt.c
> @@ -104,7 +104,7 @@ static int intel_agp_map_memory(struct agp_memory *mem)
> DBG("try mapping %lu pages\n", (unsigned long)mem->page_count);
>
> if (sg_alloc_table(&st, mem->page_count, GFP_KERNEL))
> - return -ENOMEM;
> + goto err;
>
> mem->sg_list = sg = st.sgl;
>
> @@ -113,11 +113,14 @@ static int intel_agp_map_memory(struct agp_memory *mem)
>
> mem->num_sg = pci_map_sg(intel_private.pcidev, mem->sg_list,
> mem->page_count, PCI_DMA_BIDIRECTIONAL);
> - if (unlikely(!mem->num_sg)) {
> - intel_agp_free_sglist(mem);
> - return -ENOMEM;
> - }
> + if (unlikely(!mem->num_sg))
> + goto err;
> +
> return 0;
> +
> +err:
> + sg_free_table(&st);
> + return -ENOMEM;
> }
>
> static void intel_agp_unmap_memory(struct agp_memory *mem)
> --
> 1.7.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2010-07-27 2:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-24 17:29 [PATCH 1/3] drm: Cleanup after failing to create master->unique and dev->name Chris Wilson
2010-07-24 17:29 ` [PATCH 2/3] drm: Free devname along with master->unique Chris Wilson
2010-07-24 17:29 ` [PATCH 3/3] agp/intel: Destroy the scatterlist on allocation failure Chris Wilson
2010-07-27 2:00 ` Zhenyu Wang [this message]
2010-07-27 7:42 ` Chris Wilson
2010-08-02 2:26 ` Eric Anholt
2010-07-24 17:56 ` [PATCH 1/3] drm: Cleanup after failing to create master->unique and dev->name Chris Wilson
2010-07-24 18:34 ` [PATCH] " Chris Wilson
2010-08-02 0:13 ` Dave Airlie
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=20100727020007.GC19248@zhen-devel.sh.intel.com \
--to=zhenyuw@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=dri-devel@lists.freedesktop.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