Commit daf3f0f
ASoC: wm_adsp: Don't overwrite fwf_name with the default
There's no need to overwrite fwf_name with a kstrdup() of the cs_dsp part
name. It is trivial to select either fwf_name or cs_dsp.part as the string
to use when building the filename in wm_adsp_request_firmware_file().
This leaves fwf_name entirely owned by the codec driver.
It also avoids problems with freeing the pointer. With the original code
fwf_name was either a pointer owned by the codec driver, or a kstrdup()
created by wm_adsp. This meant wm_adsp must free it if it set it, but not
if the codec driver set it. The code was handling this by using
devm_kstrdup().
But there is no absolute requirement that wm_adsp_common_init() must be
called from probe(), so this was a pseudo-memory leak - each new call to
wm_adsp_common_init() would allocate another block of memory but these
would only be freed if the owning codec driver was removed.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://msgid.link/r/20240129162737.497-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>1 parent 3657e4c commit daf3f0f
1 file changed
Lines changed: 12 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
739 | 739 | | |
740 | 740 | | |
741 | 741 | | |
| 742 | + | |
742 | 743 | | |
743 | 744 | | |
744 | 745 | | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
745 | 751 | | |
746 | 752 | | |
747 | | - | |
| 753 | + | |
748 | 754 | | |
749 | 755 | | |
750 | 756 | | |
751 | | - | |
| 757 | + | |
752 | 758 | | |
753 | 759 | | |
754 | | - | |
| 760 | + | |
755 | 761 | | |
756 | 762 | | |
757 | 763 | | |
| |||
857 | 863 | | |
858 | 864 | | |
859 | 865 | | |
860 | | - | |
861 | | - | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
862 | 869 | | |
863 | 870 | | |
864 | 871 | | |
865 | 872 | | |
866 | 873 | | |
867 | 874 | | |
868 | | - | |
869 | | - | |
870 | 875 | | |
871 | 876 | | |
872 | 877 | | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | | - | |
881 | | - | |
882 | | - | |
883 | 878 | | |
884 | 879 | | |
885 | 880 | | |
| |||
0 commit comments