panvk: Fix NULL deref on model name when device isn't supported

Instead of reproting an VK_ERROR_INCOMPATIBLE_DRIVER we were crashing as
device->model was init after this error check.

Tested on G57 but should work the same on all unsupported arch.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Fixes: f7f9b3d170 ("panvk: Move to vk_properties")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30686>
This commit is contained in:
Mary Guillemard 2024-08-16 11:04:01 +02:00 committed by Marge Bot
parent 6150967888
commit c95ef9e323

View file

@ -693,6 +693,9 @@ panvk_physical_device_init(struct panvk_physical_device *device,
pan_kmod_dev_query_props(device->kmod.dev, &device->kmod.props);
device->model = panfrost_get_model(device->kmod.props.gpu_prod_id,
device->kmod.props.gpu_variant);
unsigned arch = pan_arch(device->kmod.props.gpu_prod_id);
if (arch <= 5 || arch >= 8) {
@ -710,8 +713,6 @@ panvk_physical_device_init(struct panvk_physical_device *device,
device->master_fd = master_fd;
device->model = panfrost_get_model(device->kmod.props.gpu_prod_id,
device->kmod.props.gpu_variant);
device->formats.all = panfrost_format_table(arch);
device->formats.blendable = panfrost_blendable_format_table(arch);