From patchwork Tue Feb 7 21:04:28 2023 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: 13131498 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 70E00C6379F for ; Tue, 7 Feb 2023 13:04:59 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EB878209; Tue, 7 Feb 2023 14:04:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EB878209 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675775097; bh=5w5nwRiOyWPGhAvDD6V3qIRqLba6rNN9BRjGE7ARUWk=; h=From:To:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=M1Kjs2v7sBCVTWLJci/UDS93I5Qerua1hObE8o/jsqycoptuYQ1TnP/mJw0amXoqU g4Wk2hkGy26gib7LecAd8TBpmWo6lDWA3ZZYLSSrxmVmBYNpSOJQAQHrebPOX4K3mD 3H5TKjI91VKClA4zuKxg7VHyTPV5F7N+747ZGETY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6FBA6F80240; Tue, 7 Feb 2023 14:04:06 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 36B5FF8045D; Tue, 7 Feb 2023 14:04:04 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) (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 E2682F800E3 for ; Tue, 7 Feb 2023 14:03:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E2682F800E3 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=l3XaZhh/ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675775039; x=1707311039; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=5w5nwRiOyWPGhAvDD6V3qIRqLba6rNN9BRjGE7ARUWk=; b=l3XaZhh/BO9DgOGcSjuZhEKpSubaRp0EDMhduN7HFR9Z11yk3xAL3iug 18JM4W/f3HNQ4WKkCVQ6InoSnepLyz03K1dRGJP3R042fqA3SnB8aSMwW QgHhKTuAQre8ngZ/MwUSU+jv3XHNsM1ep/OZ3qx4SO9VPbdRlF5dttMQ1 TPdjf0NGQKL9QJXZ8olWmWzQM1VX67AQfNa3kye53B8eQNQv7CK5PSKbZ 4KVlfjJsHskMdviQh7r6vk3odLMuG+8rNME+up1Zta8Myb36m5FNPn37v GJZbNPWj+ASY5SWafJrvxWd4DxTSb+MGkzhff7ylrHRqkQRtVyslcS897 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10613"; a="391894316" X-IronPort-AV: E=Sophos;i="5.97,278,1669104000"; d="scan'208";a="391894316" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2023 05:03:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10613"; a="697273575" X-IronPort-AV: E=Sophos;i="5.97,278,1669104000"; d="scan'208";a="697273575" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga008.jf.intel.com with ESMTP; 07 Feb 2023 05:03:34 -0800 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Subject: [PATCH] ASoC: topology: Return -ENOMEM on memory allocation failure Date: Tue, 7 Feb 2023 22:04:28 +0100 Message-Id: <20230207210428.2076354-1-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Pierre-Louis Bossart , Cezary Rojewski , Dan Carpenter , alsa-devel@alsa-project.org, Takashi Iwai , Ranjani Sridharan , =?utf-8?q?Amadeusz_S?= =?utf-8?q?=C5=82awi=C5=84ski?= , Jaska Uimonen , kernel test robot Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" When handling error path, ret needs to be set to correct value. Reported-by: kernel test robot Reported-by: Dan Carpenter Fixes: d29d41e28eea ("ASoC: topology: Add support for multiple kcontrol types to a widget") Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/soc-topology.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 78223603088e..07421f5d4ebd 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1369,13 +1369,17 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, template.num_kcontrols = le32_to_cpu(w->num_kcontrols); kc = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(*kc), GFP_KERNEL); - if (!kc) + if (!kc) { + ret = -ENOMEM; goto hdr_err; + } kcontrol_type = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(unsigned int), GFP_KERNEL); - if (!kcontrol_type) + if (!kcontrol_type) { + ret = -ENOMEM; goto hdr_err; + } for (i = 0; i < le32_to_cpu(w->num_kcontrols); i++) { control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos;