Re: [PATCH] drm: fixes crct set_mode when encoder mode_fixup is null.

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

 



On Wed, Feb 10, 2016 at 12:15:22PM +0000, Carlos Palminha wrote:
> Avoids null crash when encoders don't implement mode_fixup.
> 
> Signed-off-by: Carlos Palminha <palminha@xxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_crtc_helper.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> index a02a7f9..ef3def7 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -328,10 +328,12 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
>  		}
>  
>  		encoder_funcs = encoder->helper_private;
> -		if (!(ret = encoder_funcs->mode_fixup(encoder, mode,
> -						      adjusted_mode))) {
> -			DRM_DEBUG_KMS("Encoder fixup failed\n");
> -			goto done;
> +		if (encoder_funcs->mode_fixup) {
> +			if (!(ret = encoder_funcs->mode_fixup(encoder, mode,
> +							      adjusted_mode))) {
> +				DRM_DEBUG_KMS("Encoder fixup failed\n");
> +				goto done;
> +			}

At first I thought this isn't useful since it's the old legacy helper
code that no new driver should use. But from a quick

$ git grep mode_fixup.*encoder

it looks like there's piles of existing drivers that could benefit from
this with a small cleanup. So applied it, but can you pls follow up with
patches to get rid of the now unecessary dummy functions?

Thanks, Daniel

>  		}
>  	}
>  
> -- 
> 2.5.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux