From patchwork Mon Oct 8 19:39:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Connor McAdams X-Patchwork-Id: 10631375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1C7E15E9 for ; Mon, 8 Oct 2018 19:43:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B24572465D for ; Mon, 8 Oct 2018 19:43:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A629727E63; Mon, 8 Oct 2018 19:43:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFE502465D for ; Mon, 8 Oct 2018 19:43:22 +0000 (UTC) Received: from alsa.alsa-project.org (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 31301267988; Mon, 8 Oct 2018 21:43:10 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E7F4026778A; Mon, 8 Oct 2018 21:42:16 +0200 (CEST) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by alsa0.perex.cz (Postfix) with ESMTP id CB88F26778A for ; Mon, 8 Oct 2018 21:42:13 +0200 (CEST) Received: by mail-qt1-f193.google.com with SMTP id j46-v6so6548766qtc.9 for ; Mon, 08 Oct 2018 12:42:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dHfnC+P5xZTqjSVmdAowJtFil8ME13aEEOK76Y/THA0=; b=nPGPSAUrBCB/ybkoTbtxAU1Rt1Q2QpaL7LCAv26WtROLZu4pxsg1jjZY/cgQ25EDfw zTU7vY30i4AzlxqUQClnogfx7h9mfVgZ19SXy+nkSrWDAONJw04OGTARvE3Kfp+fDWEc 48cHi1AxsLmZ1BgHl41AVhhcJgpkrb2TE1IYGFhtN1Md27EOqwYaZLaD7JQZFjlNGnea Ge2pv4UShDEjnm0SAs0aKi/5eBwBGnDFjqQeqRw/DFUntSVQ4x48uToh/tE5Qf2DPhVK ecYXoJ4VoSWEjq9rn9uX46gyMYk9aIEwmXOqUkCC8jDylamqr1LjZpSh/uF2lhpCHi1g HG9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dHfnC+P5xZTqjSVmdAowJtFil8ME13aEEOK76Y/THA0=; b=NsQKgRpvqZRLuzh3HCc65tXaWP3Y76Wtgqz7dJdbdtS/7wqJU0OgTqS4Z30C7EYk3i qKsjJBH0CcHZgBxULDHVIJ1LP7fyttFFXExEpKr5BxnsxSibeNev+mib86Qivkmh4TLz XZgtPB508ct5DfFVexXkSFFG3AOw4W+yOCBK+4Bwub+yoUwclprA23ljGwWbgHov0MEd QoA/uoQphqlQAIw4vDbwEF+pi500CM3pHxRdLdv/zPiyut1PinKtZLP7kEskx9w5Rl9Y WGmmr8CS6k5vM9cmbhRRXNsHqfN1DMC7FeLvR5yuJEXEGFvHO73VGH1izZ51xbJtOAAm TKtA== X-Gm-Message-State: ABuFfogTZd5VNwuIJr27185tQHbdFm0ZzuQPm8dV/3e7x3oPagvA2VoW PnFA25SjVTN4MiY05WOzuPc= X-Google-Smtp-Source: ACcGV62cGLAJfRAOnkdK9U98nch5pmf/dW4mqR4g9xbERObrMgHRw/qW/xfX8cQBTS9WK/gqOlq0tA== X-Received: by 2002:a0c:cb87:: with SMTP id p7mr3411335qvk.63.1539027732742; Mon, 08 Oct 2018 12:42:12 -0700 (PDT) Received: from localhost.localdomain ([2605:a000:1316:4273:f812:c27a:7560:4d6a]) by smtp.googlemail.com with ESMTPSA id 76-v6sm13220644qkc.41.2018.10.08.12.42.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Oct 2018 12:42:12 -0700 (PDT) From: Connor McAdams To: Date: Mon, 8 Oct 2018 15:39:59 -0400 Message-Id: <1539027601-20910-4-git-send-email-conmanx360@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539027601-20910-1-git-send-email-conmanx360@gmail.com> References: <1539027601-20910-1-git-send-email-conmanx360@gmail.com> Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Alastair Bridgewater , Takashi Iwai , conmanx360@gmail.com Subject: [alsa-devel] [PATCH 3/4] ALSA: hda/ca0132 - Add error checking in ca0132_build_controls() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds error checking to functions creating controls inside of ca0132_build_controls(). Signed-off-by: Connor McAdams --- sound/pci/hda/patch_ca0132.c | 47 +++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 07d50d6..693b063 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -6365,7 +6365,8 @@ static int ca0132_build_controls(struct hda_codec *codec) NULL, ca0132_alt_slave_pfxs, "Playback Switch", true, &spec->vmaster_mute.sw_kctl); - + if (err < 0) + return err; } /* Add in and out effects controls. @@ -6392,8 +6393,14 @@ static int ca0132_build_controls(struct hda_codec *codec) * prefix, and change PlayEnhancement and CrystalVoice to match. */ if (spec->use_alt_controls) { - ca0132_alt_add_svm_enum(codec); - add_ca0132_alt_eq_presets(codec); + err = ca0132_alt_add_svm_enum(codec); + if (err < 0) + return err; + + err = add_ca0132_alt_eq_presets(codec); + if (err < 0) + return err; + err = add_fx_switch(codec, PLAY_ENHANCEMENT, "Enable OutFX", 0); if (err < 0) @@ -6430,7 +6437,9 @@ static int ca0132_build_controls(struct hda_codec *codec) if (err < 0) return err; } - add_voicefx(codec); + err = add_voicefx(codec); + if (err < 0) + return err; /* * If the codec uses alt_functions, you need the enumerated controls @@ -6438,23 +6447,37 @@ static int ca0132_build_controls(struct hda_codec *codec) * setting control. */ if (spec->use_alt_functions) { - ca0132_alt_add_output_enum(codec); - ca0132_alt_add_mic_boost_enum(codec); + err = ca0132_alt_add_output_enum(codec); + if (err < 0) + return err; + err = ca0132_alt_add_mic_boost_enum(codec); + if (err < 0) + return err; /* * ZxR only has microphone input, there is no front panel * header on the card, and aux-in is handled by the DBPro board. */ - if (spec->quirk != QUIRK_ZXR) - ca0132_alt_add_input_enum(codec); + if (spec->quirk != QUIRK_ZXR) { + err = ca0132_alt_add_input_enum(codec); + if (err < 0) + return err; + } } if (spec->quirk == QUIRK_AE5) { - ae5_add_headphone_gain_enum(codec); - ae5_add_sound_filter_enum(codec); + err = ae5_add_headphone_gain_enum(codec); + if (err < 0) + return err; + err = ae5_add_sound_filter_enum(codec); + if (err < 0) + return err; } - if (spec->quirk == QUIRK_ZXR) - zxr_add_headphone_gain_switch(codec); + if (spec->quirk == QUIRK_ZXR) { + err = zxr_add_headphone_gain_switch(codec); + if (err < 0) + return err; + } #ifdef ENABLE_TUNING_CONTROLS add_tuning_ctls(codec); #endif