Browse Source

ALSA: hda: Constify hw_constraints

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the
const pointers.  Constify the corresponding static objects for better
hardening.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 8 years ago
parent
commit
50c697adfb
2 changed files with 7 additions and 7 deletions
  1. 5 5
      sound/pci/hda/patch_hdmi.c
  2. 2 2
      sound/pci/hda/patch_si3054.c

+ 5 - 5
sound/pci/hda/patch_hdmi.c

@@ -2782,21 +2782,21 @@ static int nvhdmi_7x_init_8ch(struct hda_codec *codec)
 	return 0;
 	return 0;
 }
 }
 
 
-static unsigned int channels_2_6_8[] = {
+static const unsigned int channels_2_6_8[] = {
 	2, 6, 8
 	2, 6, 8
 };
 };
 
 
-static unsigned int channels_2_8[] = {
+static const unsigned int channels_2_8[] = {
 	2, 8
 	2, 8
 };
 };
 
 
-static struct snd_pcm_hw_constraint_list hw_constraints_2_6_8_channels = {
+static const struct snd_pcm_hw_constraint_list hw_constraints_2_6_8_channels = {
 	.count = ARRAY_SIZE(channels_2_6_8),
 	.count = ARRAY_SIZE(channels_2_6_8),
 	.list = channels_2_6_8,
 	.list = channels_2_6_8,
 	.mask = 0,
 	.mask = 0,
 };
 };
 
 
-static struct snd_pcm_hw_constraint_list hw_constraints_2_8_channels = {
+static const struct snd_pcm_hw_constraint_list hw_constraints_2_8_channels = {
 	.count = ARRAY_SIZE(channels_2_8),
 	.count = ARRAY_SIZE(channels_2_8),
 	.list = channels_2_8,
 	.list = channels_2_8,
 	.mask = 0,
 	.mask = 0,
@@ -2807,7 +2807,7 @@ static int simple_playback_pcm_open(struct hda_pcm_stream *hinfo,
 				    struct snd_pcm_substream *substream)
 				    struct snd_pcm_substream *substream)
 {
 {
 	struct hdmi_spec *spec = codec->spec;
 	struct hdmi_spec *spec = codec->spec;
-	struct snd_pcm_hw_constraint_list *hw_constraints_channels = NULL;
+	const struct snd_pcm_hw_constraint_list *hw_constraints_channels = NULL;
 
 
 	switch (codec->preset->vendor_id) {
 	switch (codec->preset->vendor_id) {
 	case 0x10de0002:
 	case 0x10de0002:

+ 2 - 2
sound/pci/hda/patch_si3054.c

@@ -169,8 +169,8 @@ static int si3054_pcm_open(struct hda_pcm_stream *hinfo,
 			   struct hda_codec *codec,
 			   struct hda_codec *codec,
 			    struct snd_pcm_substream *substream)
 			    struct snd_pcm_substream *substream)
 {
 {
-	static unsigned int rates[] = { 8000, 9600, 16000 };
-	static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
+	static const unsigned int rates[] = { 8000, 9600, 16000 };
+	static const struct snd_pcm_hw_constraint_list hw_constraints_rates = {
 		.count = ARRAY_SIZE(rates),
 		.count = ARRAY_SIZE(rates),
 		.list = rates,
 		.list = rates,
 		.mask = 0,
 		.mask = 0,