From 66170cc7ed59fb7e1e192e53f1d690bd04e8c720 Mon Sep 17 00:00:00 2001 From: Richard Fitzgerald Date: Tue, 10 Mar 2026 14:18:14 +0000 Subject: [PATCH] ASoC: wm_adsp: Convert '/' to '-' when normalizing firmware filenames Don't preserve '/' in firmware filename fields - convert it to '-' like other punctuation characters. The code originally normalized the entire string, including the directory prefix. To prevent breaking the directory it had to preserve '/' characters in the name, but this meant that the system name and ALSA prefix must not contain those characters. It's trivial to skip the directory name prefix and start the normalization after it, and that means the normalization does not need to make a special case for '/'. Signed-off-by: Richard Fitzgerald Link: https://patch.msgid.link/20260310141817.1871794-8-rf@opensource.cirrus.com Signed-off-by: Mark Brown --- sound/soc/codecs/wm_adsp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 9f39db680e07..74c503fc3088 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -776,16 +776,15 @@ static int wm_adsp_request_firmware_file(struct wm_adsp *dsp, return -ENOMEM; /* - * Make sure that filename is lower-case and any non alpha-numeric - * characters except full stop and forward slash are replaced with - * hyphens. + * Make sure that filename after dir is lower-case and any non-alpha-numeric + * characters except full-stop are replaced with hyphens. */ - s = *filename; + s = *filename + strlen(dir); while (*s) { c = *s; if (isalnum(c)) *s = tolower(c); - else if ((c != '.') && (c != '/')) + else if (c != '.') *s = '-'; s++; }