All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/display: use ERR_PTR on DP tunnel manager creation fail
@ 2024-12-11 14:52 Krzysztof Karas
  2024-12-11 15:18 ` Andi Shyti
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Krzysztof Karas @ 2024-12-11 14:52 UTC (permalink / raw)
  To: intel-gfx, Michal Wajdeczko, Andi Shyti, Imre Deak
  Cc: Jani Nikula, Rodrigo Vivi

Instead of returning a generic NULL on error from drm_dp_tunnel_mgr_create(),
use error pointers with informative codes. This will also trigger IS_ERR() in
current caller (intel_dp_tunnerl_mgr_init()) instead of bypassing it via NULL
pointer.

v2: use error codes inside drm_dp_tunnel_mgr_create() instead of handling
 on caller's side (Michal, Imre)

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
---
 drivers/gpu/drm/display/drm_dp_tunnel.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/display/drm_dp_tunnel.c b/drivers/gpu/drm/display/drm_dp_tunnel.c
index 48b2df120086..90fe07a89260 100644
--- a/drivers/gpu/drm/display/drm_dp_tunnel.c
+++ b/drivers/gpu/drm/display/drm_dp_tunnel.c
@@ -1896,8 +1896,8 @@ static void destroy_mgr(struct drm_dp_tunnel_mgr *mgr)
  *
  * Creates a DP tunnel manager for @dev.
  *
- * Returns a pointer to the tunnel manager if created successfully or NULL in
- * case of an error.
+ * Returns a pointer to the tunnel manager if created successfully or error
+ * pointer in case of failure.
  */
 struct drm_dp_tunnel_mgr *
 drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count)
@@ -1907,7 +1907,7 @@ drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count)
 
 	mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
 	if (!mgr)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	mgr->dev = dev;
 	init_waitqueue_head(&mgr->bw_req_queue);
@@ -1916,7 +1916,7 @@ drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count)
 	if (!mgr->groups) {
 		kfree(mgr);
 
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 	}
 
 #ifdef CONFIG_DRM_DISPLAY_DP_TUNNEL_STATE_DEBUG
@@ -1927,7 +1927,7 @@ drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count)
 		if (!init_group(mgr, &mgr->groups[i])) {
 			destroy_mgr(mgr);
 
-			return NULL;
+			return ERR_PTR(-ENOMEM);
 		}
 
 		mgr->group_count++;
-- 
2.34.1


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

end of thread, other threads:[~2024-12-12  8:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-11 14:52 [PATCH v2] drm/display: use ERR_PTR on DP tunnel manager creation fail Krzysztof Karas
2024-12-11 15:18 ` Andi Shyti
2024-12-11 15:21   ` Andi Shyti
2024-12-11 16:11 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2024-12-11 16:52 ` ✓ i915.CI.BAT: success " Patchwork
2024-12-11 18:24 ` ✓ i915.CI.Full: " Patchwork
2024-12-11 22:42 ` [PATCH v2] " Andi Shyti
2024-12-12  8:50   ` Krzysztof Karas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.