Commit 68a71af3 authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

ASoC: Intel: avs: Use devm_kstrdup_const

FW name is constant and we just duplicate it, use const variant of
devm_kstrdup to possibly save a bit of memory.
Reviewed-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240403093145.3375857-3-amadeuszx.slawinski@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 27aa5818
...@@ -107,7 +107,7 @@ struct avs_spec { ...@@ -107,7 +107,7 @@ struct avs_spec {
}; };
struct avs_fw_entry { struct avs_fw_entry {
char *name; const char *name;
const struct firmware *fw; const struct firmware *fw;
struct list_head node; struct list_head node;
......
...@@ -250,7 +250,7 @@ int avs_request_firmware(struct avs_dev *adev, const struct firmware **fw_p, con ...@@ -250,7 +250,7 @@ int avs_request_firmware(struct avs_dev *adev, const struct firmware **fw_p, con
if (!entry) if (!entry)
return -ENOMEM; return -ENOMEM;
entry->name = kstrdup(name, GFP_KERNEL); entry->name = kstrdup_const(name, GFP_KERNEL);
if (!entry->name) { if (!entry->name) {
kfree(entry); kfree(entry);
return -ENOMEM; return -ENOMEM;
...@@ -258,7 +258,7 @@ int avs_request_firmware(struct avs_dev *adev, const struct firmware **fw_p, con ...@@ -258,7 +258,7 @@ int avs_request_firmware(struct avs_dev *adev, const struct firmware **fw_p, con
ret = request_firmware(&entry->fw, name, adev->dev); ret = request_firmware(&entry->fw, name, adev->dev);
if (ret < 0) { if (ret < 0) {
kfree(entry->name); kfree_const(entry->name);
kfree(entry); kfree(entry);
return ret; return ret;
} }
...@@ -282,7 +282,7 @@ void avs_release_last_firmware(struct avs_dev *adev) ...@@ -282,7 +282,7 @@ void avs_release_last_firmware(struct avs_dev *adev)
list_del(&entry->node); list_del(&entry->node);
release_firmware(entry->fw); release_firmware(entry->fw);
kfree(entry->name); kfree_const(entry->name);
kfree(entry); kfree(entry);
} }
...@@ -296,7 +296,7 @@ void avs_release_firmwares(struct avs_dev *adev) ...@@ -296,7 +296,7 @@ void avs_release_firmwares(struct avs_dev *adev)
list_for_each_entry_safe(entry, tmp, &adev->fw_list, node) { list_for_each_entry_safe(entry, tmp, &adev->fw_list, node) {
list_del(&entry->node); list_del(&entry->node);
release_firmware(entry->fw); release_firmware(entry->fw);
kfree(entry->name); kfree_const(entry->name);
kfree(entry); kfree(entry);
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment