From: Allen Pan <allen....@amd.com> [How] Check wheather state is NULL before releasing it.
Cc: Mario Limonciello <mario.limoncie...@amd.com> Cc: Alex Deucher <alexander.deuc...@amd.com> Cc: sta...@vger.kernel.org Reviewed-by: Charlene Liu <charlene....@amd.com> Acked-by: Alex Hung <alex.h...@amd.com> Signed-off-by: Allen Pan <allen....@amd.com> --- drivers/gpu/drm/amd/display/dc/core/dc_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_state.c b/drivers/gpu/drm/amd/display/dc/core/dc_state.c index 180ac47868c2..5cc7f8da209c 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_state.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_state.c @@ -334,7 +334,8 @@ static void dc_state_free(struct kref *kref) void dc_state_release(struct dc_state *state) { - kref_put(&state->refcount, dc_state_free); + if (state != NULL) + kref_put(&state->refcount, dc_state_free); } /* * dc_state_add_stream() - Add a new dc_stream_state to a dc_state. -- 2.34.1