forked from Minki/linux
drm/amd/display: Check for NULL when creating gamma struct
[Wjy&How] Some stress test is causing unexpected memory allocation failure. This prevents null dereference but there will likely be problems later, hard to gracefully handle memalloc fail for critical objects. Signed-off-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com> Reviewed-by: Anthony Koo <Anthony.Koo@amd.com> Acked-by: Leo Li <sunpeng.li@amd.com> Acked-by: Reza Amini <Reza.Amini@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
5dc3fc5a78
commit
ccab121723
@ -40,11 +40,14 @@ static void construct(struct dc_context *ctx, struct dc_plane_state *plane_state
|
||||
plane_state->ctx = ctx;
|
||||
|
||||
plane_state->gamma_correction = dc_create_gamma();
|
||||
plane_state->gamma_correction->is_identity = true;
|
||||
if (plane_state->gamma_correction != NULL)
|
||||
plane_state->gamma_correction->is_identity = true;
|
||||
|
||||
plane_state->in_transfer_func = dc_create_transfer_func();
|
||||
plane_state->in_transfer_func->type = TF_TYPE_BYPASS;
|
||||
plane_state->in_transfer_func->ctx = ctx;
|
||||
if (plane_state->in_transfer_func != NULL) {
|
||||
plane_state->in_transfer_func->type = TF_TYPE_BYPASS;
|
||||
plane_state->in_transfer_func->ctx = ctx;
|
||||
}
|
||||
}
|
||||
|
||||
static void destruct(struct dc_plane_state *plane_state)
|
||||
|
Loading…
Reference in New Issue
Block a user