From: Sui Jingfeng <suijingfeng@loongson.cn>
To: Thierry Reding <thierry.reding@gmail.com>,
Mikko Perttunen <mperttunen@nvidia.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Jonathan Hunter <jonathanh@nvidia.com>
Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] drm/tegra: Remove surplus else after return
Date: Mon, 26 Jun 2023 22:33:31 +0800 [thread overview]
Message-ID: <20230626143331.640454-2-suijingfeng@loongson.cn> (raw)
In-Reply-To: <20230626143331.640454-1-suijingfeng@loongson.cn>
else is not generally useful after return
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/tegra/gem.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 0ce22935fbd3..26d64f4545bd 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -180,15 +180,15 @@ static void *tegra_bo_mmap(struct host1x_bo *bo)
struct iosys_map map;
int ret;
- if (obj->vaddr) {
+ if (obj->vaddr)
return obj->vaddr;
- } else if (obj->gem.import_attach) {
+
+ if (obj->gem.import_attach) {
ret = dma_buf_vmap_unlocked(obj->gem.import_attach->dmabuf, &map);
return ret ? NULL : map.vaddr;
- } else {
- return vmap(obj->pages, obj->num_pages, VM_MAP,
- pgprot_writecombine(PAGE_KERNEL));
}
+
+ return vmap(obj->pages, obj->num_pages, VM_MAP, pgprot_writecombine(PAGE_KERNEL));
}
static void tegra_bo_munmap(struct host1x_bo *bo, void *addr)
@@ -198,10 +198,11 @@ static void tegra_bo_munmap(struct host1x_bo *bo, void *addr)
if (obj->vaddr)
return;
- else if (obj->gem.import_attach)
- dma_buf_vunmap_unlocked(obj->gem.import_attach->dmabuf, &map);
- else
- vunmap(addr);
+
+ if (obj->gem.import_attach)
+ return dma_buf_vunmap_unlocked(obj->gem.import_attach->dmabuf, &map);
+
+ vunmap(addr);
}
static struct host1x_bo *tegra_bo_get(struct host1x_bo *bo)
--
2.25.1
next prev parent reply other threads:[~2023-06-26 14:33 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 ` Sui Jingfeng [this message]
2023-10-10 15:28 ` [PATCH 2/2] drm/tegra: Remove surplus else after return 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
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=20230626143331.640454-2-suijingfeng@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).