Skip to content

Commit 30f85ed

Browse files
committed
ALSA: hda/ca0132: Use const char * for strings
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>
1 parent 9ca30a1 commit 30f85ed

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

sound/pci/hda/patch_ca0132.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ static const unsigned int effect_slider_defaults[] = {67, 65, 50, 74, 50};
174174
#define DSP_SPEAKER_OUT_LATENCY 7
175175

176176
struct ct_effect {
177-
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
177+
const char *name;
178178
hda_nid_t nid;
179179
int mid; /*effect module ID*/
180180
int reqs[EFFECT_VALS_MAX_COUNT]; /*effect module request*/
@@ -305,7 +305,7 @@ enum {
305305
};
306306

307307
struct ct_tuning_ctl {
308-
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
308+
const char *name;
309309
hda_nid_t parent_nid;
310310
hda_nid_t nid;
311311
int mid; /*effect module ID*/
@@ -418,14 +418,14 @@ static const struct ct_tuning_ctl ca0132_tuning_ctls[] = {
418418
#define VOICEFX_MAX_PARAM_COUNT 9
419419

420420
struct ct_voicefx {
421-
char *name;
421+
const char *name;
422422
hda_nid_t nid;
423423
int mid;
424424
int reqs[VOICEFX_MAX_PARAM_COUNT]; /*effect module request*/
425425
};
426426

427427
struct ct_voicefx_preset {
428-
char *name; /*preset name*/
428+
const char *name; /*preset name*/
429429
unsigned int vals[VOICEFX_MAX_PARAM_COUNT];
430430
};
431431

@@ -514,14 +514,14 @@ static const struct ct_voicefx_preset ca0132_voicefx_presets[] = {
514514
#define EQ_PRESET_MAX_PARAM_COUNT 11
515515

516516
struct ct_eq {
517-
char *name;
517+
const char *name;
518518
hda_nid_t nid;
519519
int mid;
520520
int reqs[EQ_PRESET_MAX_PARAM_COUNT]; /*effect module request*/
521521
};
522522

523523
struct ct_eq_preset {
524-
char *name; /*preset name*/
524+
const char *name; /*preset name*/
525525
unsigned int vals[EQ_PRESET_MAX_PARAM_COUNT];
526526
};
527527

@@ -679,7 +679,7 @@ enum {
679679
};
680680

681681
struct ca0132_alt_speaker_channel_cfg {
682-
char *name;
682+
const char *name;
683683
unsigned int val;
684684
};
685685

@@ -755,7 +755,7 @@ static const struct ae_ca0113_output_set ae7_ca0113_output_presets = {
755755
/* ae5 ca0113 command sequences to set headphone gain levels. */
756756
#define AE5_HEADPHONE_GAIN_PRESET_MAX_COMMANDS 4
757757
struct ae5_headphone_gain_set {
758-
char *name;
758+
const char *name;
759759
unsigned int vals[AE5_HEADPHONE_GAIN_PRESET_MAX_COMMANDS];
760760
};
761761

@@ -772,7 +772,7 @@ static const struct ae5_headphone_gain_set ae5_headphone_gain_presets[] = {
772772
};
773773

774774
struct ae5_filter_set {
775-
char *name;
775+
const char *name;
776776
unsigned int val;
777777
};
778778

@@ -5787,7 +5787,7 @@ static int ca0132_alt_effect_slider_put(struct snd_kcontrol *kcontrol,
57875787
static int ca0132_alt_mic_boost_info(struct snd_kcontrol *kcontrol,
57885788
struct snd_ctl_elem_info *uinfo)
57895789
{
5790-
char *sfx = "dB";
5790+
const char *sfx = "dB";
57915791
char namestr[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
57925792

57935793
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -5839,7 +5839,7 @@ static int ca0132_alt_mic_boost_put(struct snd_kcontrol *kcontrol,
58395839
static int ae5_headphone_gain_info(struct snd_kcontrol *kcontrol,
58405840
struct snd_ctl_elem_info *uinfo)
58415841
{
5842-
char *sfx = " Ohms)";
5842+
const char *sfx = " Ohms)";
58435843
char namestr[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
58445844

58455845
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;

0 commit comments

Comments
 (0)