Skip to contentSkip to conversation

drm/vc4: fix error code in vc4_create_object()

PATCH Applied Dan Carpenter 2 participants 2 messages Nov 18, 2021 – Nov 19, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vc4: fix error code in vc4_create_object()

The ->gem_create_object() functions are supposed to return NULL if there is an error. None of the callers expect error pointers so returing one will lead to an Oops. See drm_gem_vram_create(), for example.

Fixes c826a6e10644 ("drm/vc4: Add a BO cache.")
---
 drivers/gpu/drm/vc4/vc4_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_bo.c +1 -1
index fddaeb0b09c1..f642bd6e71ff 100644
@@ -391,7 +391,7 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size)
 
 	bo = kzalloc(sizeof(*bo), GFP_KERNEL);
 	if (!bo)
-		return ERR_PTR(-ENOMEM);
+		return NULL;
 
 	bo->madv = VC4_MADV_WILLNEED;
 	refcount_set(&bo->usecnt, 0);
Signature · 1 line
2.20.1
#1 lore raw

Re: (subset) [PATCH] drm/vc4: fix error code in vc4_create_object()

Quoted 5 lines · Dan Carpenter

The ->gem_create_object() functions are supposed to return NULL if there is an error. None of the callers expect error pointers so returing one will lead to an Oops. See drm_gem_vram_create(), for example.

Applied to drm/drm-misc (drm-misc-fixes).

Thanks!
Maxime