From 90087c1a737db207b70b8c4b72e8a67a16513f02 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Mon, 23 Dec 2024 17:46:47 +0100 Subject: [PATCH] v3d: find linear modifier when required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The goal of the commit is to fix a dead assignment detected by static analyzer: value stored to `linear_ok` is never read. But instead of just removing the dead assignment, we just remove the full variable, and instead search for the linear modifier in the place that is required. Reviewed-by: Alejandro PiƱeiro Signed-off-by: Juan A. Suarez Romero Part-of: --- src/gallium/drivers/v3d/v3d_resource.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c index 33ad83ba3a1..d8de2002154 100644 --- a/src/gallium/drivers/v3d/v3d_resource.c +++ b/src/gallium/drivers/v3d/v3d_resource.c @@ -788,7 +788,6 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen, { struct v3d_screen *screen = v3d_screen(pscreen); - bool linear_ok = drm_find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count); struct v3d_resource *rsc = v3d_resource_setup(pscreen, tmpl); struct pipe_resource *prsc = &rsc->base; /* Use a tiled layout if we can, for better 3D performance. */ @@ -828,13 +827,12 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen, /* No user-specified modifier; determine our own. */ if (count == 1 && modifiers[0] == DRM_FORMAT_MOD_INVALID) { - linear_ok = true; rsc->tiled = should_tile; } else if (should_tile && drm_find_modifier(DRM_FORMAT_MOD_BROADCOM_UIF, modifiers, count)) { rsc->tiled = true; - } else if (linear_ok) { + } else if (drm_find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count)) { rsc->tiled = false; } else { fprintf(stderr, "Unsupported modifier requested\n");