drm/gem: Improve drm_gem_objects_lookup() kerneldoc
Subsystems (2)
PATCH 1/1 drm/gem: Improve drm_gem_objects_lookup() kerneldoc
Make clear that the returned array has to be free using kvfree().
While at it, fix broken reference to non-existant @objs and allow for more error codes on failure.
--- drivers/gpu/drm/drm_gem.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_gem.c +6 -5
@@ -821,13 +821,14 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,* Takes an array of userspace handles and returns a newly allocated array of * GEM objects. * +* After a successul lookup GEM objects need to be released using +* drm_gem_object_put() and the array returned in @objs_out must be freed using +* kvfree(). +* * For a single handle lookup, use drm_gem_object_lookup(). * -* Returns: -* @objs filled in with GEM object pointers. Returned GEM objects need to be -* released with drm_gem_object_put(). -ENOENT is returned on a lookup -* failure. 0 is returned on success. -* +* Return: +* Zero on success or a negative error code. */ int drm_gem_objects_lookup (struct drm_file *filp,void __user *bo_handles,int count,struct drm_gem_object ***objs_out)
Signature · 1 line
2.52.0
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 26 lines
-----Original Message-----
From: Tvrtko Ursulin <[email protected]>
Sent: Monday, March 16, 2026 3:08 PM
To: [email protected]
Cc: [email protected]; Tvrtko Ursulin <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH] drm/gem: Improvedrm_gem_objects_lookup()kerneldocMake clear that the returned array has to be free using
kvfree().While at it, fix broken reference to non-existant @objs and allow for more error codes on failure.
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Srinivasan Shanmugam <[email protected]>Cc Sunil Khatri <[email protected]>--- drivers/gpu/drm/drm_gem.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_gem.c index renamed from drivers/gpu/drm/drm_gem.c +0
-0
fdf08cae1c5b..124cc5f3d9ff100644
drivers/gpu/drm/drm_gem.c static int objects_lookup(struct drm_file *filp, u32 · line 825
Quoted 5 lines
drivers/gpu/drm/drm_gem.c +1
-0@@ -821,13 +821,14 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count, * Takes an array of userspace handles and returns a newly allocated array of * GEM objects. * + * After a successul lookup GEM objects need to be released using
Reflects the function contract, especially documenting ownership of the returned @objs_out array and that it must be freed with kvfree(),
This helper is important as it converts userspace GEM handles into referenced kernel GEM objects, ensuring they remain valid while used by the caller (for example, when operating on multiple buffer objects in a single request, such as GPU submissions).
Minor nit:
s/successul/successful/
Quoted 18 lines
drivers/gpu/drm/drm_gem.c +6
-6+* drm_gem_object_put() and the array returned in @objs_out must be +freed using +* kvfree(). +* * For a single handle lookup, use drm_gem_object_lookup(). * -* Returns: -* @objs filled in with GEM object pointers. Returned GEM objects need to be -* released with drm_gem_object_put(). -ENOENT is returned on a lookup -* failure. 0 is returned on success. -* +* Return: +* Zero on success or a negative error code. */ int drm_gem_objects_lookup (struct drm_file *filp,void __user *bo_handles,int count,struct drm_gem_object ***objs_out) --2.52.0