From: Nicholas Kazlauskas Date: Tue, 31 Mar 2020 20:45:31 +0000 (-0400) Subject: drm/amd/display: Check ramp != NULL before applying lut1d for degamma X-Git-Tag: v5.8-rc1~194^2~15^2~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d652509e7a244761755403a2ae3fb6c96183226e;p=thirdparty%2Flinux.git drm/amd/display: Check ramp != NULL before applying lut1d for degamma [Why] A NULL ramp is a valid configuration for passing into mod_color_calculate_degamma_params but we'll hit a NULL pointer if we do so. We need this in order to get the right transfer function to do degamma on NV12 formats where we aren't supplied with a custom user degamma. [How] Add the NULL check. Signed-off-by: Nicholas Kazlauskas Reviewed-by: Zhan Liu Acked-by: Rodrigo Siqueira Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c index cac09d500fda9..d47253cdcc4e1 100644 --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c @@ -1902,7 +1902,7 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf, - if (ramp->type == GAMMA_CUSTOM) + if (ramp && ramp->type == GAMMA_CUSTOM) apply_lut_1d(ramp, MAX_HW_POINTS, tf_pts); ret = true;