Skip to content

Commit d32e716

Browse files
glneomathieupoirier
authored andcommitted
remoteproc: keystone: Use devm_kasprintf() to build name string
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
1 parent 74de965 commit d32e716

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

drivers/remoteproc/keystone_remoteproc.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,6 @@ static int keystone_rproc_probe(struct platform_device *pdev)
366366
struct rproc *rproc;
367367
int dsp_id;
368368
char *fw_name = NULL;
369-
char *template = "keystone-dsp%d-fw";
370-
int name_len = 0;
371369
int ret = 0;
372370

373371
if (!np) {
@@ -382,11 +380,9 @@ static int keystone_rproc_probe(struct platform_device *pdev)
382380
}
383381

384382
/* construct a custom default fw name - subject to change in future */
385-
name_len = strlen(template); /* assuming a single digit alias */
386-
fw_name = devm_kzalloc(dev, name_len, GFP_KERNEL);
383+
fw_name = devm_kasprintf(dev, GFP_KERNEL, "keystone-dsp%d-fw", dsp_id);
387384
if (!fw_name)
388385
return -ENOMEM;
389-
snprintf(fw_name, name_len, template, dsp_id);
390386

391387
rproc = rproc_alloc(dev, dev_name(dev), &keystone_rproc_ops, fw_name,
392388
sizeof(*ksproc));

0 commit comments

Comments
 (0)