Linux-remoteproc Archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] remoteproc: keystone: Use devm_kasprintf() to build name string
@ 2024-08-02 18:22 Andrew Davis
  2024-08-02 18:22 ` [PATCH 2/7] remoteproc: keystone: Use devm_rproc_alloc() helper Andrew Davis
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Andrew Davis @ 2024-08-02 18:22 UTC (permalink / raw)
  To: Hari Nagalla, Bjorn Andersson, Mathieu Poirier
  Cc: linux-remoteproc, linux-kernel, Andrew Davis

This is simpler and removes the need to assume the id length to be 1
digit, which then removes a W=1 compile warning about the same.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/remoteproc/keystone_remoteproc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c
index 7e57b90bcaf85..81b179e269a1e 100644
--- a/drivers/remoteproc/keystone_remoteproc.c
+++ b/drivers/remoteproc/keystone_remoteproc.c
@@ -366,8 +366,6 @@ static int keystone_rproc_probe(struct platform_device *pdev)
 	struct rproc *rproc;
 	int dsp_id;
 	char *fw_name = NULL;
-	char *template = "keystone-dsp%d-fw";
-	int name_len = 0;
 	int ret = 0;
 
 	if (!np) {
@@ -382,11 +380,9 @@ static int keystone_rproc_probe(struct platform_device *pdev)
 	}
 
 	/* construct a custom default fw name - subject to change in future */
-	name_len = strlen(template); /* assuming a single digit alias */
-	fw_name = devm_kzalloc(dev, name_len, GFP_KERNEL);
+	fw_name = devm_kasprintf(dev, GFP_KERNEL, "keystone-dsp%d-fw", dsp_id);
 	if (!fw_name)
 		return -ENOMEM;
-	snprintf(fw_name, name_len, template, dsp_id);
 
 	rproc = rproc_alloc(dev, dev_name(dev), &keystone_rproc_ops, fw_name,
 			    sizeof(*ksproc));
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-08-13 15:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-02 18:22 [PATCH 1/7] remoteproc: keystone: Use devm_kasprintf() to build name string Andrew Davis
2024-08-02 18:22 ` [PATCH 2/7] remoteproc: keystone: Use devm_rproc_alloc() helper Andrew Davis
2024-08-02 18:22 ` [PATCH 3/7] remoteproc: keystone: Use devm action to release reserved memory Andrew Davis
2024-08-13 15:55   ` Mathieu Poirier
2024-08-02 18:22 ` [PATCH 4/7] remoteproc: keystone: Use devm_pm_runtime_enable() helper Andrew Davis
2024-08-02 18:22 ` [PATCH 5/7] remoteproc: keystone: Use devm action to call PM runtime put sync Andrew Davis
2024-08-02 18:22 ` [PATCH 6/7] remoteproc: keystone: Use devm_gpiod_get() helper Andrew Davis
2024-08-02 18:23 ` [PATCH 7/7] remoteproc: keystone: Use devm_rproc_add() helper Andrew Davis
2024-08-08 11:34 ` [PATCH 1/7] remoteproc: keystone: Use devm_kasprintf() to build name string Hari Nagalla

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 read-only IMAP folder(s) and NNTP newsgroup(s).