From: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 4/7] accel/qaic: Drop the reference to BO in error path of create BO IOCTL
Date: Mon, 11 Dec 2023 12:25:12 +0100 [thread overview]
Message-ID: <daba3227-a4ad-45c6-afd3-fa84bc1f45f5@linux.intel.com> (raw)
In-Reply-To: <20231208163457.1295993-5-quic_jhugo@quicinc.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
On 08.12.2023 17:34, Jeffrey Hugo wrote:
> From: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
>
> 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: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com>
> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> ---
> drivers/accel/qaic/qaic_data.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
> index 89ab8fa19315..7faa00705c1d 100644
> --- a/drivers/accel/qaic/qaic_data.c
> +++ b/drivers/accel/qaic/qaic_data.c
> @@ -574,6 +574,9 @@ static void qaic_free_sgt(struct sg_table *sgt)
> {
> struct scatterlist *sg;
>
> + if (!sgt)
> + return;
> +
> for (sg = sgt->sgl; sg; sg = sg_next(sg))
> if (sg_page(sg))
> __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
>
> ret = drm_gem_handle_create(file_priv, obj, &args->handle);
> if (ret)
> - goto free_sgt;
> + goto free_bo;
>
> bo->handle = args->handle;
> drm_gem_object_put(obj);
> @@ -726,10 +729,8 @@ int qaic_create_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *fi
>
> return 0;
>
> -free_sgt:
> - qaic_free_sgt(bo->sgt);
> free_bo:
> - kfree(bo);
> + drm_gem_object_put(obj);
> unlock_dev_srcu:
> srcu_read_unlock(&qdev->dev_lock, qdev_rcu_id);
> unlock_usr_srcu:
next prev parent reply other threads:[~2023-12-11 11:25 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-08 16:34 [PATCH 0/7] qaic cleanups for 6.8 Jeffrey Hugo
2023-12-08 16:34 ` Jeffrey Hugo
2023-12-08 16:34 ` [PATCH 1/7] accel/qaic: Deprecate ->size field from attach slice IOCTL structure Jeffrey Hugo
2023-12-08 16:34 ` Jeffrey Hugo
2023-12-11 11:23 ` Jacek Lawrynowicz
2023-12-08 16:34 ` [PATCH 2/7] accel/qaic: Remove bo->queued field Jeffrey Hugo
2023-12-08 16:34 ` Jeffrey Hugo
2023-12-11 11:24 ` Jacek Lawrynowicz
2023-12-08 16:34 ` [PATCH 3/7] accel/qaic: Fix MHI channel struct field order Jeffrey Hugo
2023-12-08 16:34 ` Jeffrey Hugo
2023-12-11 11:23 ` Jacek Lawrynowicz
2023-12-08 16:34 ` [PATCH 4/7] accel/qaic: Drop the reference to BO in error path of create BO IOCTL Jeffrey Hugo
2023-12-08 16:34 ` Jeffrey Hugo
2023-12-11 11:25 ` Jacek Lawrynowicz [this message]
2023-12-08 16:34 ` [PATCH 5/7] accel/qaic: Call drm_gem_create_mmap_offset() once for each BO Jeffrey Hugo
2023-12-08 16:34 ` Jeffrey Hugo
2023-12-11 11:26 ` Jacek Lawrynowicz
2023-12-08 16:34 ` [PATCH 6/7] accel/qaic: Leverage DRM managed APIs to release resources Jeffrey Hugo
2023-12-08 16:34 ` Jeffrey Hugo
2023-12-15 18:06 ` Jeffrey Hugo
2023-12-15 18:06 ` Jeffrey Hugo
2023-12-20 7:02 ` Jacek Lawrynowicz
2023-12-20 18:11 ` Jeffrey Hugo
2023-12-08 16:34 ` [PATCH 7/7] accel/qaic: Order pci_remove() operations in reverse of probe() Jeffrey Hugo
2023-12-08 16:34 ` Jeffrey Hugo
2023-12-11 11:27 ` Jacek Lawrynowicz
2023-12-15 18:05 ` [PATCH 0/7] qaic cleanups for 6.8 Jeffrey Hugo
2023-12-15 18:05 ` Jeffrey Hugo
2023-12-20 18:20 ` Jeffrey Hugo
2023-12-20 18:20 ` Jeffrey Hugo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=daba3227-a4ad-45c6-afd3-fa84bc1f45f5@linux.intel.com \
--to=jacek.lawrynowicz@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.