From: Andi Shyti <andi.shyti@linux.intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>,
dri-devel <dri-devel@lists.freedesktop.org>
Cc: Andi Shyti <andi.shyti@kernel.org>, Zilin Guan <zilin@seu.edu.cn>,
Krzysztof Karas <krzysztof.karas@intel.com>,
Andi Shyti <andi.shyti@linux.intel.com>
Subject: [PATCH v3] drm/i915: Use symmetric free for vma resources
Date: Tue, 18 Nov 2025 15:01:18 +0100 [thread overview]
Message-ID: <20251118140118.220339-1-andi.shyti@linux.intel.com> (raw)
From: Zilin Guan <zilin@seu.edu.cn>
The error paths in reserve_gtt_with_resource() and
insert_gtt_with_resource() use kfree() to release a vma_res object
that was allocated with i915_vma_resource_alloc().
While kfree() can handle slab-allocated objects, it is better practice
to use the symmetric free function.
Replace kfree() with the specific i915_vma_resource_free() helper to
improve readability and ensure the alloc/free pairing is explicit.
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20251113063405.116845-1-zilin@seu.edu.cn
---
Hi,
I'm resending this patch so that CI takes it and tests it
Changes in v3 (from Andi):
- Added my SoB and r-b tag.
Changes in v2 (from Zilin):
- Reword commit message to describe this as a readability change.
- Drop the Fixes tag.
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index 0a86e4857539..e9df4b9f5ebe 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -1528,7 +1528,7 @@ static int reserve_gtt_with_resource(struct i915_vma *vma, u64 offset)
i915_vma_resource_init_from_vma(vma_res, vma);
vma->resource = vma_res;
} else {
- kfree(vma_res);
+ i915_vma_resource_free(vma_res);
}
mutex_unlock(&vm->mutex);
@@ -1708,7 +1708,7 @@ static int insert_gtt_with_resource(struct i915_vma *vma)
i915_vma_resource_init_from_vma(vma_res, vma);
vma->resource = vma_res;
} else {
- kfree(vma_res);
+ i915_vma_resource_free(vma_res);
}
mutex_unlock(&vm->mutex);
--
2.51.0
next reply other threads:[~2025-11-18 14:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 14:01 Andi Shyti [this message]
2025-11-18 17:00 ` ✓ i915.CI.BAT: success for drm/i915: Use symmetric free for vma resources (rev2) Patchwork
2025-11-18 21:43 ` ✗ i915.CI.Full: failure " Patchwork
2025-11-19 14:24 ` ✓ i915.CI.BAT: success for drm/i915: Use symmetric free for vma resources (rev3) Patchwork
2025-11-19 16:57 ` ✓ i915.CI.Full: " Patchwork
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=20251118140118.220339-1-andi.shyti@linux.intel.com \
--to=andi.shyti@linux.intel.com \
--cc=andi.shyti@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=krzysztof.karas@intel.com \
--cc=zilin@seu.edu.cn \
/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