From patchwork Mon Nov 30 13:37:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 7724161 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 50C3DBEEE1 for ; Mon, 30 Nov 2015 13:38:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8967D20549 for ; Mon, 30 Nov 2015 13:38:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7F88E20534 for ; Mon, 30 Nov 2015 13:38:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9B788926A; Mon, 30 Nov 2015 05:38:04 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1193088610 for ; Mon, 30 Nov 2015 05:38:04 -0800 (PST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0B39EAD67; Mon, 30 Nov 2015 13:38:01 +0000 (UTC) From: Takashi Iwai To: intel-gfx@lists.freedesktop.org, alsa-devel@alsa-project.org Date: Mon, 30 Nov 2015 14:37:50 +0100 Message-Id: <1448890671-2983-7-git-send-email-tiwai@suse.de> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1448890671-2983-1-git-send-email-tiwai@suse.de> References: <1448890671-2983-1-git-send-email-tiwai@suse.de> Cc: Mengdong Lin , Vinod Koul , Daniel Vetter , David Henningsson Subject: [Intel-gfx] [PATCH 6/7] ALSA: hda - Do zero-clear in snd_hdmi_parse_eld() itself X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 code. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_eld.c | 1 + sound/pci/hda/patch_hdmi.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 563984dd2562..bc2e08257c2e 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c @@ -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) { diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 8378c31e0b4f..23a4292c355f 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -1628,7 +1628,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; @@ -2118,7 +2117,6 @@ static void sync_eld_via_acomp(struct hda_codec *codec, eld->eld_buffer, ELD_MAX_SIZE); if (size > 0) { - memset(&eld->info, 0, sizeof(eld->info)); if (snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer, size) < 0) size = -EINVAL;