Skip to contentSkip to conversation

drm/vc4: Fix an error code vc4_create_object()

PATCH Superseded Dan Carpenter 1 participant 1 message Jun 15, 2020

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

PATCH 1/1 drm/vc4: Fix an error code vc4_create_object()

The vc4_create_object() needs to return NULL on error, not error pointers. If it returns an error pointer then that will lead to an Oops in the callers. Fortunately, in current kernels small allocations always succed so this will never happen.

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 72d30d90b856c..0af246a5609ca 100644
@@ -389,7 +389,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.26.2