Skip to content

Commit 080b2e7

Browse files
KKaras169169ideak
authored andcommitted
drm/display: use ERR_PTR on DP tunnel manager creation fail
Instead of returning a generic NULL on error from drm_dp_tunnel_mgr_create(), use error pointers with informative codes to align the function with stub that is executed when CONFIG_DRM_DISPLAY_DP_TUNNEL is unset. 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) v3: fixup commit message and add "CC"/"Fixes" lines (Andi), mention aligning function code with stub Fixes: 91888b5 ("drm/i915/dp: Add support for DP tunnel BW allocation") Cc: Imre Deak <[email protected]> Cc: <[email protected]> # v6.9+ Signed-off-by: Krzysztof Karas <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Signed-off-by: Imre Deak <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/7q4fpnmmztmchczjewgm6igy55qt6jsm7tfd4fl4ucfq6yg2oy@q4lxtsu6445c
1 parent d2bd3fc commit 080b2e7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/gpu/drm/display/drm_dp_tunnel.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,8 +1896,8 @@ static void destroy_mgr(struct drm_dp_tunnel_mgr *mgr)
18961896
*
18971897
* Creates a DP tunnel manager for @dev.
18981898
*
1899-
* Returns a pointer to the tunnel manager if created successfully or NULL in
1900-
* case of an error.
1899+
* Returns a pointer to the tunnel manager if created successfully or error
1900+
* pointer in case of failure.
19011901
*/
19021902
struct drm_dp_tunnel_mgr *
19031903
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)
19071907

19081908
mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
19091909
if (!mgr)
1910-
return NULL;
1910+
return ERR_PTR(-ENOMEM);
19111911

19121912
mgr->dev = dev;
19131913
init_waitqueue_head(&mgr->bw_req_queue);
@@ -1916,7 +1916,7 @@ drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count)
19161916
if (!mgr->groups) {
19171917
kfree(mgr);
19181918

1919-
return NULL;
1919+
return ERR_PTR(-ENOMEM);
19201920
}
19211921

19221922
#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)
19271927
if (!init_group(mgr, &mgr->groups[i])) {
19281928
destroy_mgr(mgr);
19291929

1930-
return NULL;
1930+
return ERR_PTR(-ENOMEM);
19311931
}
19321932

19331933
mgr->group_count++;

0 commit comments

Comments
 (0)