]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: hda/ca0132: Use const char * for strings
authorTakashi Iwai <tiwai@suse.de>
Thu, 12 Jun 2025 06:48:01 +0000 (08:48 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 12 Jun 2025 06:53:00 +0000 (08:53 +0200)
Some static strings have been stored in fixed char arrays although
they could be gracefully "const char *" instead.  Also, a few other
definitions use the raw "char *" without const.

Converting those to "const char *" will save some memory and give more
safety, in addition to a side-effect to address the bogus compiler
warning with snprintf().

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506121025.G9uunMlx-lkp@intel.com/
Link: https://patch.msgid.link/20250612064802.1170-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_ca0132.c

index 1904964591dbc9af1f4fa701945bc22d42b7d7a1..686ce0947131bc62af43851ace76f0400363af41 100644 (file)
@@ -174,7 +174,7 @@ static const unsigned int effect_slider_defaults[] = {67, 65, 50, 74, 50};
 #define DSP_SPEAKER_OUT_LATENCY         7
 
 struct ct_effect {
-       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+       const char *name;
        hda_nid_t nid;
        int mid; /*effect module ID*/
        int reqs[EFFECT_VALS_MAX_COUNT]; /*effect module request*/
@@ -305,7 +305,7 @@ enum {
 };
 
 struct ct_tuning_ctl {
-       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+       const char *name;
        hda_nid_t parent_nid;
        hda_nid_t nid;
        int mid; /*effect module ID*/
@@ -418,14 +418,14 @@ static const struct ct_tuning_ctl ca0132_tuning_ctls[] = {
 #define VOICEFX_MAX_PARAM_COUNT 9
 
 struct ct_voicefx {
-       char *name;
+       const char *name;
        hda_nid_t nid;
        int mid;
        int reqs[VOICEFX_MAX_PARAM_COUNT]; /*effect module request*/
 };
 
 struct ct_voicefx_preset {
-       char *name; /*preset name*/
+       const char *name; /*preset name*/
        unsigned int vals[VOICEFX_MAX_PARAM_COUNT];
 };
 
@@ -514,14 +514,14 @@ static const struct ct_voicefx_preset ca0132_voicefx_presets[] = {
 #define EQ_PRESET_MAX_PARAM_COUNT 11
 
 struct ct_eq {
-       char *name;
+       const char *name;
        hda_nid_t nid;
        int mid;
        int reqs[EQ_PRESET_MAX_PARAM_COUNT]; /*effect module request*/
 };
 
 struct ct_eq_preset {
-       char *name; /*preset name*/
+       const char *name; /*preset name*/
        unsigned int vals[EQ_PRESET_MAX_PARAM_COUNT];
 };
 
@@ -679,7 +679,7 @@ enum {
 };
 
 struct ca0132_alt_speaker_channel_cfg {
-       char *name;
+       const char *name;
        unsigned int val;
 };
 
@@ -755,7 +755,7 @@ static const struct ae_ca0113_output_set ae7_ca0113_output_presets = {
 /* ae5 ca0113 command sequences to set headphone gain levels. */
 #define AE5_HEADPHONE_GAIN_PRESET_MAX_COMMANDS 4
 struct ae5_headphone_gain_set {
-       char *name;
+       const char *name;
        unsigned int vals[AE5_HEADPHONE_GAIN_PRESET_MAX_COMMANDS];
 };
 
@@ -772,7 +772,7 @@ static const struct ae5_headphone_gain_set ae5_headphone_gain_presets[] = {
 };
 
 struct ae5_filter_set {
-       char *name;
+       const char *name;
        unsigned int val;
 };
 
@@ -5787,7 +5787,7 @@ static int ca0132_alt_effect_slider_put(struct snd_kcontrol *kcontrol,
 static int ca0132_alt_mic_boost_info(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_info *uinfo)
 {
-       char *sfx = "dB";
+       const char *sfx = "dB";
        char namestr[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
 
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -5839,7 +5839,7 @@ static int ca0132_alt_mic_boost_put(struct snd_kcontrol *kcontrol,
 static int ae5_headphone_gain_info(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_info *uinfo)
 {
-       char *sfx = " Ohms)";
+       const char *sfx = " Ohms)";
        char namestr[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
 
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;