Re: [PATCH v3] drm/display: use ERR_PTR on DP tunnel manager creation fail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 13, 2024 at 05:29:30PM +0100, Andi Shyti wrote:
> Hi,
> 
> who is going to take this patch? Can I merge it in
> drm-intel-next?

It has only DRM changes and is a fix for stable, so should be
drm-misc-fixes. I merged it now there, thanks for the patch and the
review.

> Thanks,
> Andi
> 
> On Thu, Dec 12, 2024 at 11:00:41AM +0000, Krzysztof Karas wrote:
> > 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: 91888b5b1ad2 ("drm/i915/dp: Add support for DP tunnel BW allocation")
> > Cc: Imre Deak <imre.deak@xxxxxxxxx>
> > Cc: <stable@xxxxxxxxxxxxxxx> # v6.9+
> > Signed-off-by: Krzysztof Karas <krzysztof.karas@xxxxxxxxx>
> > Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx>
> > ---
> >  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



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux