From: Markus Elfring <Markus.Elfring@web.de>
To: ntb@lists.linux.dev, kernel-janitors@vger.kernel.org,
Allen Hubbe <allenbh@gmail.com>,
Dave Jiang <dave.jiang@intel.com>, Jon Mason <jdmason@kudzu.us>,
Max Hawking <maxahawking@sonnenkinder.org>,
Serge Semin <fancer.lancer@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] ntb_perf: Delete duplicate dmaengine_unmap_put() call in perf_copy_chunk()
Date: Mon, 23 Sep 2024 11:15:15 +0200 [thread overview]
Message-ID: <a58d6585-4573-44bd-b315-770ca3a54af6@web.de> (raw)
In-Reply-To: <c7654504-a455-4972-9861-39800732d0df@web.de>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 23 Sep 2024 10:38:11 +0200
The function call “dmaengine_unmap_put(unmap)” was used in an if branch.
The same call was immediately triggered by a subsequent goto statement.
Thus avoid such a call repetition.
This issue was detected by using the Coccinelle software.
Fixes: 5648e56d03fa ("NTB: ntb_perf: Add full multi-port NTB API support")
Cc: stable@vger.kernel.org
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
I imagine that a single function call “dmaengine_unmap_put(unmap)”
can be sufficient for this use case.
https://elixir.bootlin.com/linux/v6.11/source/drivers/dma/dmaengine.c#L1377
How do you think about to improve resource management any further?
drivers/ntb/test/ntb_perf.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
index 72bc1d017a46..dfd175f79e8f 100644
--- a/drivers/ntb/test/ntb_perf.c
+++ b/drivers/ntb/test/ntb_perf.c
@@ -839,10 +839,8 @@ static int perf_copy_chunk(struct perf_thread *pthr,
dma_set_unmap(tx, unmap);
ret = dma_submit_error(dmaengine_submit(tx));
- if (ret) {
- dmaengine_unmap_put(unmap);
+ if (ret)
goto err_free_resource;
- }
dmaengine_unmap_put(unmap);
--
2.46.1
next prev parent reply other threads:[~2024-09-23 9:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 9:11 [PATCH 0/2] ntb_perf: Adjustments for perf_copy_chunk() Markus Elfring
2024-09-23 9:15 ` Markus Elfring [this message]
2024-09-23 9:16 ` [PATCH 2/2] ntb_perf: Use common error handling code in perf_copy_chunk() Markus Elfring
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=a58d6585-4573-44bd-b315-770ca3a54af6@web.de \
--to=markus.elfring@web.de \
--cc=allenbh@gmail.com \
--cc=dave.jiang@intel.com \
--cc=fancer.lancer@gmail.com \
--cc=jdmason@kudzu.us \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxahawking@sonnenkinder.org \
--cc=ntb@lists.linux.dev \
/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
all inboxes | Powered by JetHome®