linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sui Jingfeng <suijingfeng@loongson.cn>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Mikko Perttunen <mperttunen@nvidia.com>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drm/tegra: Return an error code if fails
Date: Wed, 11 Oct 2023 11:06:11 +0800	[thread overview]
Message-ID: <03a7a1be-a78a-3380-4b65-091bef0914b6@loongson.cn> (raw)
In-Reply-To: <ZSVuVcqdGfGtQIQj@orome.fritz.box>

Hi,


On 2023/10/10 23:31, Thierry Reding wrote:
> On Tue, Oct 10, 2023 at 03:22:56PM +0200, Thierry Reding wrote:
>> On Mon, Jun 26, 2023 at 10:33:30PM +0800, Sui Jingfeng wrote:
>>> Return -ENOMEM if tegra_bo_mmap() fails.
>>>
>>> Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
>>> ---
>>>   drivers/gpu/drm/tegra/gem.c | 2 ++
>>>   1 file changed, 2 insertions(+)
>> Sorry, this fell through the cracks. I think it'd be better if
>> tegra_bo_mmap() were to be improved to always return either an ERR_PTR()
>> encoded error code or a valid pointer. Throwing NULL into the mix isn't
>> useful because it typically means something like -ENOMEM anyway. Error
>> codes are more explicit, so since we're already using them for some
>> cases, might as well return them for all.
>>
>> Actually, looks like tegra_bo_mmap() never actually returns an ERR_PTR()
>> encoded error code. It's either obj->vaddr, the return value of vmap()
>> (which is either NULL or the address of the mapping), or the address
>> obtained from dma_buf_vmap_unlocked() (i.e. map.vaddr) or NULL on
>> failure. So I think it would equally make sense to keep your patch and
>> to remove the IS_ERR() check below it.
>>
>> I would slightly prefer the first option, but either is fine.
> How about the attached patch?


I also prefer the prefer the first option.
The attached patch is more better, because it solve the problem at lower level.

Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>

> Thierry


      reply	other threads:[~2023-10-11  3:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 14:33 [PATCH 1/2] drm/tegra: Return an error code if fails Sui Jingfeng
2023-06-26 14:33 ` [PATCH 2/2] drm/tegra: Remove surplus else after return Sui Jingfeng
2023-10-10 15:28   ` Thierry Reding
2023-07-27 10:02 ` [1/2] drm/tegra: Return an error code if fails suijingfeng
2023-10-10 13:22 ` [PATCH 1/2] " Thierry Reding
2023-10-10 15:31   ` Thierry Reding
2023-10-11  3:06     ` Sui Jingfeng [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=03a7a1be-a78a-3380-4b65-091bef0914b6@loongson.cn \
    --to=suijingfeng@loongson.cn \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mperttunen@nvidia.com \
    --cc=thierry.reding@gmail.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;
as well as URLs for NNTP newsgroup(s).