Commit ce5fed9a authored by Pranjal Ramajor Asha Kanojiya's avatar Pranjal Ramajor Asha Kanojiya Committed by Jeffrey Hugo

accel/qaic: Drop the reference to BO in error path of create BO IOCTL

Do not free BO explicitly in error path, just drop its reference, cleanup
will be taken care by DRM as we have registered for ->free() callback.
This patch makes sure that there is only one code path for BO to be freed.
Signed-off-by: default avatarPranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
Reviewed-by: default avatarCarl Vanderlip <quic_carlv@quicinc.com>
Reviewed-by: default avatarJeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: default avatarJeffrey Hugo <quic_jhugo@quicinc.com>
Reviewed-by: default avatarJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231208163457.1295993-5-quic_jhugo@quicinc.com
parent fbd60a67
...@@ -574,6 +574,9 @@ static void qaic_free_sgt(struct sg_table *sgt) ...@@ -574,6 +574,9 @@ static void qaic_free_sgt(struct sg_table *sgt)
{ {
struct scatterlist *sg; struct scatterlist *sg;
if (!sgt)
return;
for (sg = sgt->sgl; sg; sg = sg_next(sg)) for (sg = sgt->sgl; sg; sg = sg_next(sg))
if (sg_page(sg)) if (sg_page(sg))
__free_pages(sg_page(sg), get_order(sg->length)); __free_pages(sg_page(sg), get_order(sg->length));
...@@ -717,7 +720,7 @@ int qaic_create_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *fi ...@@ -717,7 +720,7 @@ int qaic_create_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *fi
ret = drm_gem_handle_create(file_priv, obj, &args->handle); ret = drm_gem_handle_create(file_priv, obj, &args->handle);
if (ret) if (ret)
goto free_sgt; goto free_bo;
bo->handle = args->handle; bo->handle = args->handle;
drm_gem_object_put(obj); drm_gem_object_put(obj);
...@@ -726,10 +729,8 @@ int qaic_create_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *fi ...@@ -726,10 +729,8 @@ int qaic_create_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *fi
return 0; return 0;
free_sgt:
qaic_free_sgt(bo->sgt);
free_bo: free_bo:
kfree(bo); drm_gem_object_put(obj);
unlock_dev_srcu: unlock_dev_srcu:
srcu_read_unlock(&qdev->dev_lock, qdev_rcu_id); srcu_read_unlock(&qdev->dev_lock, qdev_rcu_id);
unlock_usr_srcu: unlock_usr_srcu:
......
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