AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Khatri, Sunil" <sukhatri@amd.com>
To: "Sunil Khatri" <sunil.khatri@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Cc: amd-gfx@lists.freedesktop.org, kernel test robot <lkp@intel.com>,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH v3] drm/amdgpu: clean up the amdgpu_cs_parser_bos
Date: Wed, 4 Feb 2026 11:59:16 +0530	[thread overview]
Message-ID: <d49d5962-e50a-4465-b91c-8702b0e8418c@amd.com> (raw)
In-Reply-To: <20260204062401.2299187-1-sunil.khatri@amd.com>

Ignore this patch version as v4 is pushed.

Regards
Sunil Khatri

On 04-02-2026 11:54 am, Sunil Khatri wrote:
> In low memory conditions when kmalloc can fail and hence
> we need to clean up the bo list and unlock the mutex for
> clean exit.
>
> Fixes: 737da5363cc0 ("drm/amdgpu: update the functions to use amdgpu version of hmm")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202602030017.7E0xShmH-lkp@intel.com/
> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index d591dce0f3b3..b166bccecee3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -892,8 +892,10 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
>   		struct amdgpu_bo *bo = e->bo;
>   
>   		e->range = amdgpu_hmm_range_alloc(NULL);
> -		if (unlikely(!e->range))
> -			return -ENOMEM;
> +		if (unlikely(!e->range)) {
> +			r = -ENOMEM;
> +			goto out_free_user_pages;
> +		}
>   
>   		r = amdgpu_ttm_tt_get_user_pages(bo, e->range);
>   		if (r)
> @@ -998,6 +1000,8 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
>   		amdgpu_hmm_range_free(e->range);
>   		e->range = NULL;
>   	}
> +
> +	amdgpu_bo_list_put(p->bo_list);
>   	mutex_unlock(&p->bo_list->bo_list_mutex);
>   	return r;
>   }

      reply	other threads:[~2026-02-04  6:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04  6:24 [PATCH v3] drm/amdgpu: clean up the amdgpu_cs_parser_bos Sunil Khatri
2026-02-04  6:29 ` Khatri, Sunil [this message]

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=d49d5962-e50a-4465-b91c-8702b0e8418c@amd.com \
    --to=sukhatri@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dan.carpenter@linaro.org \
    --cc=lkp@intel.com \
    --cc=sunil.khatri@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox