amdgpu: Add a default marketing name if none is found
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 26 Sep 2022 21:19:27 +0000 (17:19 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 17 Oct 2022 20:19:44 +0000 (16:19 -0400)
Apparently quite a few apps use this API to get the GPU
name and end up with NULL as the GPU name.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
amdgpu/amdgpu_device.c

index 73fd27f..aeb5e3c 100644 (file)
@@ -292,7 +292,10 @@ drm_public int amdgpu_device_get_fd(amdgpu_device_handle device_handle)
 
 drm_public const char *amdgpu_get_marketing_name(amdgpu_device_handle dev)
 {
-       return dev->marketing_name;
+       if (dev->marketing_name)
+               return dev->marketing_name;
+       else
+               return "AMD Radeon Graphics";
 }
 
 drm_public int amdgpu_query_sw_info(amdgpu_device_handle dev,