Commit 48563800 authored by Maxime Ripard's avatar Maxime Ripard

Merge drm-misc-next-fixes-2024-01-19 into drm-misc-fixes

Merge the last drm-misc-next-fixes tag that fell through the cracks.
Signed-off-by: default avatarMaxime Ripard <mripard@kernel.org>
parents 1c1914d6 1f1626ac
......@@ -201,7 +201,7 @@ int ttm_device_init(struct ttm_device *bdev, const struct ttm_device_funcs *func
bool use_dma_alloc, bool use_dma32)
{
struct ttm_global *glob = &ttm_glob;
int ret;
int ret, nid;
if (WARN_ON(vma_manager == NULL))
return -EINVAL;
......@@ -221,7 +221,12 @@ int ttm_device_init(struct ttm_device *bdev, const struct ttm_device_funcs *func
ttm_sys_man_init(bdev);
ttm_pool_init(&bdev->pool, dev, dev_to_node(dev), use_dma_alloc, use_dma32);
if (dev)
nid = dev_to_node(dev);
else
nid = NUMA_NO_NODE;
ttm_pool_init(&bdev->pool, dev, nid, use_dma_alloc, use_dma32);
bdev->vma_manager = vma_manager;
spin_lock_init(&bdev->lru_lock);
......
......@@ -147,6 +147,13 @@ v3d_job_allocate(void **container, size_t size)
return 0;
}
static void
v3d_job_deallocate(void **container)
{
kfree(*container);
*container = NULL;
}
static int
v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
struct v3d_job *job, void (*free)(struct kref *ref),
......@@ -273,8 +280,10 @@ v3d_setup_csd_jobs_and_bos(struct drm_file *file_priv,
ret = v3d_job_init(v3d, file_priv, &(*job)->base,
v3d_job_free, args->in_sync, se, V3D_CSD);
if (ret)
if (ret) {
v3d_job_deallocate((void *)job);
return ret;
}
ret = v3d_job_allocate((void *)clean_job, sizeof(**clean_job));
if (ret)
......@@ -282,8 +291,10 @@ v3d_setup_csd_jobs_and_bos(struct drm_file *file_priv,
ret = v3d_job_init(v3d, file_priv, *clean_job,
v3d_job_free, 0, NULL, V3D_CACHE_CLEAN);
if (ret)
if (ret) {
v3d_job_deallocate((void *)clean_job);
return ret;
}
(*job)->args = *args;
......@@ -860,8 +871,10 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
ret = v3d_job_init(v3d, file_priv, &render->base,
v3d_render_job_free, args->in_sync_rcl, &se, V3D_RENDER);
if (ret)
if (ret) {
v3d_job_deallocate((void *)&render);
goto fail;
}
render->start = args->rcl_start;
render->end = args->rcl_end;
......@@ -874,8 +887,10 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
ret = v3d_job_init(v3d, file_priv, &bin->base,
v3d_job_free, args->in_sync_bcl, &se, V3D_BIN);
if (ret)
if (ret) {
v3d_job_deallocate((void *)&bin);
goto fail;
}
bin->start = args->bcl_start;
bin->end = args->bcl_end;
......@@ -892,8 +907,10 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
ret = v3d_job_init(v3d, file_priv, clean_job,
v3d_job_free, 0, NULL, V3D_CACHE_CLEAN);
if (ret)
if (ret) {
v3d_job_deallocate((void *)&clean_job);
goto fail;
}
last_job = clean_job;
} else {
......@@ -1015,8 +1032,10 @@ v3d_submit_tfu_ioctl(struct drm_device *dev, void *data,
ret = v3d_job_init(v3d, file_priv, &job->base,
v3d_job_free, args->in_sync, &se, V3D_TFU);
if (ret)
if (ret) {
v3d_job_deallocate((void *)&job);
goto fail;
}
job->base.bo = kcalloc(ARRAY_SIZE(args->bo_handles),
sizeof(*job->base.bo), GFP_KERNEL);
......@@ -1233,8 +1252,10 @@ v3d_submit_cpu_ioctl(struct drm_device *dev, void *data,
ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
v3d_job_free, 0, &se, V3D_CPU);
if (ret)
if (ret) {
v3d_job_deallocate((void *)&cpu_job);
goto fail;
}
clean_job = cpu_job->indirect_csd.clean_job;
csd_job = cpu_job->indirect_csd.job;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment