Fix defect reported by Coverity Scan.
Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking image suggests that it may be
null, but it has already been dereferenced on all paths leading to
the check.
Fixes:
ad609bf55a87 ("frontend/dri: Implement mapping individual planes.")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6807>
struct dri_context *ctx = dri_context(context);
struct pipe_context *pipe = ctx->st->pipe;
enum pipe_map_flags pipe_access = 0;
- struct pipe_resource *resource = image->texture;
struct pipe_transfer *trans;
void *map;
if (plane >= dri2_get_mapping_by_format(image->dri_format)->nplanes)
return NULL;
+ struct pipe_resource *resource = image->texture;
while (plane--)
resource = resource->next;