linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/vc4: fix error code in vc4_create_object()
@ 2021-11-18 11:14 Dan Carpenter
  2021-11-19 11:00 ` (subset) " Maxime Ripard
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-11-18 11:14 UTC (permalink / raw)
  To: Emma Anholt
  Cc: Maxime Ripard, David Airlie, Daniel Vetter, dri-devel,
	linux-kernel, kernel-janitors

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.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/vc4/vc4_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
index fddaeb0b09c1..f642bd6e71ff 100644
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: (subset) [PATCH] drm/vc4: fix error code in vc4_create_object()
  2021-11-18 11:14 [PATCH] drm/vc4: fix error code in vc4_create_object() Dan Carpenter
@ 2021-11-19 11:00 ` Maxime Ripard
  0 siblings, 0 replies; 2+ messages in thread
From: Maxime Ripard @ 2021-11-19 11:00 UTC (permalink / raw)
  To: Dan Carpenter, Emma Anholt
  Cc: Maxime Ripard, kernel-janitors, David Airlie, dri-devel,
	Daniel Vetter, Maxime Ripard, linux-kernel

On Thu, 18 Nov 2021 14:14:16 +0300, Dan Carpenter wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-19 11:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 11:14 [PATCH] drm/vc4: fix error code in vc4_create_object() Dan Carpenter
2021-11-19 11:00 ` (subset) " Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).