ALSA: hda: Constify hw_constraints
authorTakashi Iwai <tiwai@suse.de>
Wed, 7 Jun 2017 12:20:07 +0000 (14:20 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 9 Jun 2017 08:42:52 +0000 (10:42 +0200)
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>
sound/pci/hda/patch_hdmi.c
sound/pci/hda/patch_si3054.c

index 90e4ff87445e866088f39c11cddf1326e2ea4e4d..0d7955eec20119465d4e8277d30cd1dfeac1553d 100644 (file)
@@ -2782,21 +2782,21 @@ static int nvhdmi_7x_init_8ch(struct hda_codec *codec)
        return 0;
 }
 
-static unsigned int channels_2_6_8[] = {
+static const unsigned int channels_2_6_8[] = {
        2, 6, 8
 };
 
-static unsigned int channels_2_8[] = {
+static const unsigned int channels_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),
        .list = channels_2_6_8,
        .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),
        .list = channels_2_8,
        .mask = 0,
@@ -2807,7 +2807,7 @@ static int simple_playback_pcm_open(struct hda_pcm_stream *hinfo,
                                    struct snd_pcm_substream *substream)
 {
        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) {
        case 0x10de0002:
index ffda38c45509583dd9e43f5f119c5d835b23e05b..f63acb1b965c0e588e31dc848a2fe1cb73116405 100644 (file)
@@ -169,8 +169,8 @@ static int si3054_pcm_open(struct hda_pcm_stream *hinfo,
                           struct hda_codec *codec,
                            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),
                .list = rates,
                .mask = 0,