OSDN Git Service

drm/amd/display: Avoid NULL pointer in set_backlight when ABM is NULL
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Thu, 2 Apr 2020 19:59:44 +0000 (15:59 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 22 Apr 2020 22:11:47 +0000 (18:11 -0400)
[Why]
On ASIC without ABM support (most dGPU) we run into a null pointer
dereference when attempting to set the backlight level.

[How]
This function requires ABM, so fix up the condition to only allow
DMCU to be optional.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Wyatt Wood <Wyatt.Wood@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link.c

index 1c5c11d..a926c1c 100644 (file)
@@ -2462,8 +2462,7 @@ bool dc_link_set_backlight_level(const struct dc_link *link,
        int i;
        DC_LOGGER_INIT(link->ctx->logger);
 
-       if ((dmcu == NULL && abm == NULL) ||
-               (abm->funcs->set_backlight_level_pwm == NULL))
+       if (abm == NULL || (abm->funcs->set_backlight_level_pwm == NULL))
                return false;
 
        if (dmcu)