linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: bjorn.andersson@linaro.org, ohad@wizery.com
Cc: elder@linaro.org, s-anna@ti.com, Markus.Elfring@web.de,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 2/4] remoteproc: Restructure firmware name allocation
Date: Mon, 20 Apr 2020 17:15:59 -0600	[thread overview]
Message-ID: <20200420231601.16781-3-mathieu.poirier@linaro.org> (raw)
In-Reply-To: <20200420231601.16781-1-mathieu.poirier@linaro.org>

Improve the readability of function rproc_alloc_firmware() by using
a non-negated condition and moving the comment out of the conditional
block

Suggested-by: Alex Elder <elder@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
---
 drivers/remoteproc/remoteproc_core.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index db8a15fc1e4a..45529d40342f 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -2011,14 +2011,14 @@ static int rproc_alloc_firmware(struct rproc *rproc,
 {
 	const char *p;
 
-	if (!firmware)
-		/*
-		 * If the caller didn't pass in a firmware name then
-		 * construct a default name.
-		 */
-		p = kasprintf(GFP_KERNEL, "rproc-%s-fw", name);
-	else
+	/*
+	 * Allocate a firmware name if the caller gave us one to work
+	 * with.  Otherwise construct a new one using a default pattern.
+	 */
+	if (firmware)
 		p = kstrdup_const(firmware, GFP_KERNEL);
+	else
+		p = kasprintf(GFP_KERNEL, "rproc-%s-fw", name);
 
 	if (!p)
 		return -ENOMEM;
-- 
2.20.1


  parent reply	other threads:[~2020-04-20 23:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20 23:15 [PATCH v3 0/4] remoteproc: Refactor function rproc_alloc() Mathieu Poirier
2020-04-20 23:15 ` [PATCH v3 1/4] remoteproc: Use kstrdup_const() rather than kstrdup() Mathieu Poirier
2020-04-21  1:56   ` Bjorn Andersson
2020-04-20 23:15 ` Mathieu Poirier [this message]
2020-04-21  1:56   ` [PATCH v3 2/4] remoteproc: Restructure firmware name allocation Bjorn Andersson
2020-04-20 23:16 ` [PATCH v3 3/4] remoteproc: Split rproc_ops allocation from rproc_alloc() Mathieu Poirier
2020-04-21  1:57   ` Bjorn Andersson
2020-04-20 23:16 ` [PATCH v3 4/4] remoteproc: Get rid of tedious error path Mathieu Poirier
2020-04-21  2:01   ` Bjorn Andersson

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=20200420231601.16781-3-mathieu.poirier@linaro.org \
    --to=mathieu.poirier@linaro.org \
    --cc=Markus.Elfring@web.de \
    --cc=bjorn.andersson@linaro.org \
    --cc=elder@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=ohad@wizery.com \
    --cc=s-anna@ti.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).