Skip to content

Commit 66170cc

Browse files
rfvirgilbroonie
authored andcommitted
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 <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20260310141817.1871794-8-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent f8f0c68 commit 66170cc

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

sound/soc/codecs/wm_adsp.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -776,16 +776,15 @@ static int wm_adsp_request_firmware_file(struct wm_adsp *dsp,
776776
return -ENOMEM;
777777

778778
/*
779-
* Make sure that filename is lower-case and any non alpha-numeric
780-
* characters except full stop and forward slash are replaced with
781-
* hyphens.
779+
* Make sure that filename after dir is lower-case and any non-alpha-numeric
780+
* characters except full-stop are replaced with hyphens.
782781
*/
783-
s = *filename;
782+
s = *filename + strlen(dir);
784783
while (*s) {
785784
c = *s;
786785
if (isalnum(c))
787786
*s = tolower(c);
788-
else if ((c != '.') && (c != '/'))
787+
else if (c != '.')
789788
*s = '-';
790789
s++;
791790
}

0 commit comments

Comments
 (0)