intel/dev: Use intel_i915_query_alloc in query_topology

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11770>
This commit is contained in:
Jason Ekstrand
2021-07-07 14:41:20 -05:00
committed by Marge Bot
parent 3fa6b8d041
commit ba99d2a328
+2 -19
View File
@@ -1360,26 +1360,9 @@ getparam_topology(struct intel_device_info *devinfo, int fd)
static bool
query_topology(struct intel_device_info *devinfo, int fd)
{
struct drm_i915_query_item item = {
.query_id = DRM_I915_QUERY_TOPOLOGY_INFO,
};
struct drm_i915_query query = {
.num_items = 1,
.items_ptr = (uintptr_t) &item,
};
if (intel_ioctl(fd, DRM_IOCTL_I915_QUERY, &query))
return false;
if (item.length < 0)
return false;
struct drm_i915_query_topology_info *topo_info =
(struct drm_i915_query_topology_info *) calloc(1, item.length);
item.data_ptr = (uintptr_t) topo_info;
if (intel_ioctl(fd, DRM_IOCTL_I915_QUERY, &query) ||
item.length <= 0)
intel_i915_query_alloc(fd, DRM_I915_QUERY_TOPOLOGY_INFO);
if (topo_info == NULL)
return false;
update_from_topology(devinfo, topo_info);