ALSA: hda - Do zero-clear in snd_hdmi_parse_eld() itself
authorTakashi Iwai <tiwai@suse.de>
Fri, 13 Nov 2015 11:51:49 +0000 (12:51 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 4 Dec 2015 14:06:45 +0000 (15:06 +0100)
Instead of doing in each caller side, snd_hdmi_parse_eld() does
zero-clear of the parsed data by itself.  This is safer and simplifies
the upcoming code changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_eld.c
sound/pci/hda/patch_hdmi.c

index 563984dd25622008e5bf377ba10cc99c25f72635..bc2e08257c2e55a91d03a64813684be6cc708c84 100644 (file)
@@ -253,6 +253,7 @@ int snd_hdmi_parse_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e,
        int mnl;
        int i;
 
+       memset(e, 0, sizeof(*e));
        e->eld_ver = GRAB_BITS(buf, 0, 3, 5);
        if (e->eld_ver != ELD_VER_CEA_861D &&
            e->eld_ver != ELD_VER_PARTIAL) {
index da264e8acce25cccd992f01f8991f95e073e298b..901a3a7248ed49a8c2132b33d3ac19db55e6bb3b 100644 (file)
@@ -1570,7 +1570,6 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
                                                     &eld->eld_size) < 0)
                        eld->eld_valid = false;
                else {
-                       memset(&eld->info, 0, sizeof(struct parsed_hdmi_eld));
                        if (snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer,
                                                    eld->eld_size) < 0)
                                eld->eld_valid = false;