From: Nicholas Kazlauskas <nicholas.kazlaus...@amd.com>

[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 <nicholas.kazlaus...@amd.com>
Reviewed-by: Zhan Liu <zhan....@amd.com>
Acked-by: Rodrigo Siqueira <rodrigo.sique...@amd.com>
---
 drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 cac09d500fda..d47253cdcc4e 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;
-- 
2.26.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to