radeonsi: Move NULL check before dereference.

Fix defect reported by Coverity Scan.

Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking desc suggests that it may be
null, but it has already been dereferenced on all paths leading to
the check.

Fixes: 2f83dce059 ("radeonsi: don't report R64_*INT as a sampler format because it doesn't work")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16380>
This commit is contained in:
Vinson Lee 2022-05-06 17:17:50 -07:00 committed by Marge Bot
parent 14b1ed1ce1
commit 997dc0a5e8

View file

@ -2188,6 +2188,9 @@ static bool si_is_sampler_format_supported(struct pipe_screen *screen, enum pipe
struct si_screen *sscreen = (struct si_screen *)screen;
const struct util_format_description *desc = util_format_description(format);
if (!desc)
return false;
/* Samplers don't support 64 bits per channel. */
if (desc->layout == UTIL_FORMAT_LAYOUT_PLAIN &&
desc->channel[0].size == 64)
@ -2200,9 +2203,6 @@ static bool si_is_sampler_format_supported(struct pipe_screen *screen, enum pipe
return true;
}
if (!desc)
return false;
return si_translate_texformat(screen, format, desc,
util_format_get_first_non_void_channel(format)) != ~0U;
}