]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge drm-misc-next-fixes-2024-01-19 into drm-misc-fixes
authorMaxime Ripard <mripard@kernel.org>
Mon, 5 Feb 2024 11:20:52 +0000 (12:20 +0100)
committerMaxime Ripard <mripard@kernel.org>
Mon, 5 Feb 2024 11:20:52 +0000 (12:20 +0100)
Merge the last drm-misc-next-fixes tag that fell through the cracks.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/ttm/ttm_device.c
drivers/gpu/drm/v3d/v3d_submit.c

index e787c155a56922e6a84c7c0d785e6af98e4e2256..76027960054f1140e768ae21b30e5a3015437d02 100644 (file)
@@ -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);
index fcff41dd2315b710dc9de6ccdb361922c61d2602..88f63d526b22365b42b90e90d5b451a56e3fda52 100644 (file)
@@ -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;