From: Andi Shyti <andi.shyti@linux.intel.com>
To: Krzysztof Karas <krzysztof.karas@intel.com>
Cc: intel-gfx@lists.freedesktop.org,
Michal Wajdeczko <michal.wajdeczko@intel.com>,
Andi Shyti <andi.shyti@linux.intel.com>,
Imre Deak <imre.deak@intel.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH v2] drm/display: use ERR_PTR on DP tunnel manager creation fail
Date: Wed, 11 Dec 2024 16:18:06 +0100 [thread overview]
Message-ID: <Z1mtLhJ_40VtfF3M@ashyti-mobl2.lan> (raw)
In-Reply-To: <x46u4zhhpnxgohyguhqsc4d73sbjwipebxp5uiwkopejsy6dpz@v3eysonfbmk2>
Hi Krzysztof,
On Wed, Dec 11, 2024 at 02:52:20PM +0000, Krzysztof Karas wrote:
> 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.
I was about to suggest fixing either this or his counterpart in
the header file.
Please send this in a series along with the previous patch in
order to let people understand why you are sending this.
Besides, I think you can improve the explanation here, which is
the different behaviour of drm_dp_tunnel_mgr_create() depending
on the CONFIG_DRM_DISPLAY_DP_TUNNEL config flag.
You can add to both of them my r-b.
Did you check who is maintaining this file?
Andi
> 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
next prev parent reply other threads:[~2024-12-11 15:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z1mtLhJ_40VtfF3M@ashyti-mobl2.lan \
--to=andi.shyti@linux.intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=krzysztof.karas@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=rodrigo.vivi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.