drm/komeda: check for error-valued pointer
authorAmjad Ouled-Ameur <amjad.ouled-ameur@arm.com>
Mon, 10 Jun 2024 10:20:56 +0000 (11:20 +0100)
committerMaxime Ripard <mripard@kernel.org>
Mon, 10 Jun 2024 11:20:37 +0000 (13:20 +0200)
komeda_pipeline_get_state() may return an error-valued pointer, thus
check the pointer for negative or null value before dereferencing.

Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
Signed-off-by: Amjad Ouled-Ameur <amjad.ouled-ameur@arm.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240610102056.40406-1-amjad.ouled-ameur@arm.com
drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c

index f3e7441..f4e76b4 100644 (file)
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,
        u32 avail_scalers;
 
        pipe_st = komeda_pipeline_get_state(c->pipeline, state);
-       if (!pipe_st)
+       if (IS_ERR_OR_NULL(pipe_st))
                return NULL;
 
        avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^