diff options
author | Mathieu Poirier <[email protected]> | 2020-04-20 17:15:59 -0600 |
---|---|---|
committer | Bjorn Andersson <[email protected]> | 2020-04-20 19:29:46 -0700 |
commit | 9d5f82c8ba2471e34150a0e750ef54089e2a3740 (patch) | |
tree | b33e380bc3d8b226d8ea1a876d546f25b7316664 | |
parent | 1487deda19c82d30d1867277e89bc2d515b9d2d4 (diff) |
remoteproc: Restructure firmware name allocation
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 <[email protected]>
Signed-off-by: Mathieu Poirier <[email protected]>
Reviewed-by: Alex Elder <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Bjorn Andersson <[email protected]>
-rw-r--r-- | drivers/remoteproc/remoteproc_core.c | 14 |
1 files 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; |