From patchwork Tue Jan 11 19:05:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 12709699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9B400C433F5 for ; Tue, 11 Jan 2022 11:07:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7DA85191E; Tue, 11 Jan 2022 12:06:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7DA85191E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1641899253; bh=OtbOL6czH+V9UwzRDcJLW274jPXhpIq7QfZpEbgwKCE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=moHfvN+r3cBb2Qh1BrhFjqTl5pftcsXUy9xPRBMdNWTiHg/RKJ2MnJ+/Idva8ZuEK wyffJqBQeZMsjX81LvhbhHYu52iOrJ1laJKaWkYyTJmc84IAduHgfanAVnrta78h2Z c+Qyz/rndg/QBNWcN6expJh4rEWuRVEcvKJXnadE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BA526F80430; Tue, 11 Jan 2022 12:06:11 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 871E4F804AC; Tue, 11 Jan 2022 12:06:08 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E84D1F80054 for ; Tue, 11 Jan 2022 12:06:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E84D1F80054 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XC4mFaq5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641899163; x=1673435163; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OtbOL6czH+V9UwzRDcJLW274jPXhpIq7QfZpEbgwKCE=; b=XC4mFaq5vftjzEACB3cHLCrCTjOOpYPDy8k+xW15JlhftKmuCVk8nFaW vLdw8ryQjXBsDv9IFmqeeREtHu4vemudRzLsJbIFxXGrS7vUiDHwX23FF pQo5S4XKgfLfOZJMHOZISu70WP1sYpBfTPXxj8ORAXSA1dbcJJMMe7R9b OHLJwPxica3rsXZ7h/qdlK/0KLLNPucjqbTM/Hu4rX55/gceX10Nvfq4T UEu8MEM0+a3V5qGVuueU6i28rqYw8kZVxsqpEC1C0fP7+DRgTKqcF2zmG YLoo/n/3mzAzHBuI+JeXodwqUVCkdleMUtNG0NzHZSfC+vCVsS+6svIdg g==; X-IronPort-AV: E=McAfee;i="6200,9189,10223"; a="241012608" X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="241012608" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2022 03:05:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="528700936" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga008.jf.intel.com with ESMTP; 11 Jan 2022 03:05:55 -0800 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Liam Girdwood , Mark Brown , Takashi Iwai Subject: [PATCH 1/3] ASoC: topology: Remove superfluous error prints Date: Tue, 11 Jan 2022 20:05:26 +0100 Message-Id: <20220111190528.445248-2-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220111190528.445248-1-amadeuszx.slawinski@linux.intel.com> References: <20220111190528.445248-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , =?utf-8?q?Amadeusz_S=C5=82a?= =?utf-8?q?wi=C5=84ski?= , Pierre-Louis Bossart , alsa-devel@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" soc_tplg_check_elem_count(), already prints an error when applicable, so there is no need to print another one. Also clean up alignment of arguments in if, so there is no confusion about what is checked and what is executed if condition is true. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/soc-topology.c | 44 ++++++++++------------------------------ 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 078e1dc19ca6..e0f72ddd72c1 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -685,12 +685,9 @@ static int soc_tplg_dbytes_create(struct soc_tplg *tplg, unsigned int count, int err = 0; if (soc_tplg_check_elem_count(tplg, - sizeof(struct snd_soc_tplg_bytes_control), count, - size, "mixer bytes")) { - dev_err(tplg->dev, "ASoC: Invalid count %d for byte control\n", - count); + sizeof(struct snd_soc_tplg_bytes_control), + count, size, "mixer bytes")) return -EINVAL; - } for (i = 0; i < count; i++) { be = (struct snd_soc_tplg_bytes_control *)tplg->pos; @@ -763,13 +760,9 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count, int err = 0; if (soc_tplg_check_elem_count(tplg, - sizeof(struct snd_soc_tplg_mixer_control), - count, size, "mixers")) { - - dev_err(tplg->dev, "ASoC: invalid count %d for controls\n", - count); + sizeof(struct snd_soc_tplg_mixer_control), + count, size, "mixers")) return -EINVAL; - } for (i = 0; i < count; i++) { mc = (struct snd_soc_tplg_mixer_control *)tplg->pos; @@ -927,13 +920,9 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count, int err = 0; if (soc_tplg_check_elem_count(tplg, - sizeof(struct snd_soc_tplg_enum_control), - count, size, "enums")) { - - dev_err(tplg->dev, "ASoC: invalid count %d for enum controls\n", - count); + sizeof(struct snd_soc_tplg_enum_control), + count, size, "enums")) return -EINVAL; - } for (i = 0; i < count; i++) { ec = (struct snd_soc_tplg_enum_control *)tplg->pos; @@ -1111,13 +1100,9 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg, count = le32_to_cpu(hdr->count); if (soc_tplg_check_elem_count(tplg, - sizeof(struct snd_soc_tplg_dapm_graph_elem), - count, le32_to_cpu(hdr->payload_size), "graph")) { - - dev_err(tplg->dev, "ASoC: invalid count %d for DAPM routes\n", - count); + sizeof(struct snd_soc_tplg_dapm_graph_elem), + count, le32_to_cpu(hdr->payload_size), "graph")) return -EINVAL; - } dev_dbg(tplg->dev, "ASoC: adding %d DAPM routes for index %d\n", count, hdr->index); @@ -1965,11 +1950,8 @@ static int soc_tplg_pcm_elems_load(struct soc_tplg *tplg, if (soc_tplg_check_elem_count(tplg, size, count, le32_to_cpu(hdr->payload_size), - "PCM DAI")) { - dev_err(tplg->dev, "ASoC: invalid count %d for PCM DAI elems\n", - count); + "PCM DAI")) return -EINVAL; - } for (i = 0; i < count; i++) { pcm = (struct snd_soc_tplg_pcm *)tplg->pos; @@ -2243,14 +2225,10 @@ static int soc_tplg_link_elems_load(struct soc_tplg *tplg, return -EINVAL; } - if (soc_tplg_check_elem_count(tplg, - size, count, + if (soc_tplg_check_elem_count(tplg, size, count, le32_to_cpu(hdr->payload_size), - "physical link config")) { - dev_err(tplg->dev, "ASoC: invalid count %d for physical link elems\n", - count); + "physical link config")) return -EINVAL; - } /* config physical DAI links */ for (i = 0; i < count; i++) {