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>
(cherry picked from commit c95ef9e323)
This commit is contained in:
Mary Guillemard 2024-08-16 11:04:01 +02:00 committed by Eric Engestrom
parent b073826a38
commit c799cfe577
2 changed files with 4 additions and 3 deletions

View file

@ -144,7 +144,7 @@
"description": "panvk: Fix NULL deref on model name when device isn't supported",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "f7f9b3d170f5213d4f20df8ef92827dd97899432",
"notes": null

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);