From patchwork Mon Jul 1 07:39:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 810030 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 A3802C3065A for ; Mon, 1 Jul 2024 07:40:58 +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 F3169211C; Mon, 1 Jul 2024 09:40:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F3169211C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1719819656; bh=aNXS5oDU9Iznltvue5eW7LGccDPE1uOvOu0B8DutizM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=NURaCeFbzB1eyvZVtly4URqw4Y967oZG7LE19PpkhUoTpY79binG2BTFnQ6JnLbqy CBqKo6oodrHixdqGD9d+l8uvV6emBPn/xCWDBptjDl2MnsKsBPcMPkKfArrGYysD6i faR+HKIHpfe0FU/dOOzeGjHh5PTUUBrNuknbfsyw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D6B58F805D6; Mon, 1 Jul 2024 09:40:06 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 8B1B9F805E6; Mon, 1 Jul 2024 09:40:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D4545F80578; Mon, 1 Jul 2024 09:40:00 +0200 (CEST) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0D158F8003A for ; Mon, 1 Jul 2024 09:39:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0D158F8003A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=eSzcHD8y Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-425814992aeso4511275e9.1 for ; Mon, 01 Jul 2024 00:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719819587; x=1720424387; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=JV+cRI0obrw7Gr1AmKeclFNXK4wRSUvRfIa7nX0CC5w=; b=eSzcHD8yOCE9ALvQvi1ioyDR8akcqpl/tHusV31XF2RhSjwS1elCw+HTeTHWR6znqi p+yODnxj6g5LYECdk9z7+XTTwUFHcWKbt2FYYvbmfsCwh5Ej6iJrEC75+7KSS+80JHsG 2zLFgz0+tACT3Tln5eHbCcxuFrHgbzjMBmxmGcbDjnjyNKJkEukIjOxY8QSjHTfbj4jE UD+ODSoMm0deNnQ4vRvtF3jEjMHCbTWyyQY/6hVu4KvKTICfx499Eeg4gXBIn+ZpqXva YgBkQnPiE+16WVQ8Sf+LJg2dV75ze0LU5jYulio0ceE4fuTXqSYHlP1SxzWRWsIYkfrC 5CDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719819587; x=1720424387; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JV+cRI0obrw7Gr1AmKeclFNXK4wRSUvRfIa7nX0CC5w=; b=i9somcuMVqLyqrSFqBM1hlBG2OljXu9FjILg/Y0KkOO/anzDKQYlX+fEi4vJ+NXjT5 6V+CytBZNajEeKqPcW120stS6ySffphRv82iOpiB4FgwN7hRnuqCA8vp/2W3yIDf0jBs kjLYGDZxspO4YbyXQqT4Z7VdTZbjBpU6zgI5MkGZV9OAIP2WotnYgmx9GyRLskiZ+VSD 4unFqVJ3uypB9z2cFPgvix1rL1uY12zLuNYmqhm0pOO5ZExFNJQLUQjwgiyBoZQmzZB4 OC2z9dKl+yVMM2K0kkN7Y94QclI5SqyrtixRWbXDfJ8xqooDp/P+Iw9Pb14JsnNE04oN aPew== X-Gm-Message-State: AOJu0Yx7sR69uvdxl3dEJcT0zk7dND9cqRhBZf5Rq6i00mZkp8VP6Ffu Nw5wbmxmYXnT01WOsVXqcUFDdezODFqQdGamYvqHVJHSM89a6A2Ok9SbbUqxnEA= X-Google-Smtp-Source: AGHT+IG2h/MuEwnoTZQebFv4r/85gHz9u6yettb/wJx89L0LKVLKCmHMSB/zmGvvRwXSMwxJCfcw+A== X-Received: by 2002:a5d:5702:0:b0:35f:1c34:adfc with SMTP id ffacd0b85a97d-36775729a52mr2645023f8f.67.1719819587542; Mon, 01 Jul 2024 00:39:47 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0fb9absm9279936f8f.80.2024.07.01.00.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 00:39:47 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 01 Jul 2024 09:39:33 +0200 Subject: [PATCH v3 1/6] ASoC: codecs: lpass-rx-macro: Simplify PDS cleanup with devm MIME-Version: 1.0 Message-Id: <20240701-b4-qcom-audio-lpass-codec-cleanups-v3-1-6d98d4dd1ef5@linaro.org> References: <20240701-b4-qcom-audio-lpass-codec-cleanups-v3-0-6d98d4dd1ef5@linaro.org> In-Reply-To: <20240701-b4-qcom-audio-lpass-codec-cleanups-v3-0-6d98d4dd1ef5@linaro.org> To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3634; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=aNXS5oDU9Iznltvue5eW7LGccDPE1uOvOu0B8DutizM=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmgl07ZZ/P0X2KbPfUiKc26QrbS8ijbeuElhemc 0YPAc1aqKWJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZoJdOwAKCRDBN2bmhouD 15HHD/0ZHIWDX7+vSu+VVLfTCkXyU0PPIYh+vbTkyulS/CJ/ece8SI3bkYXj+QUATQJRxQjQGMY uboQLbCcXh2A7dhSgLPIJ85W7YyIl5GbUw934lXELcxrcs0RZVhQfDFND4+aRi3oNwOqXUqW2UM HvAdb8RhF2kEn0PW4TiE2IFbGcrs0k58KTPVwcaLrTNzIFt4aHr9UAXctUUZ9lONL8+BYwl8Z/2 /hKdpuccDFw2np7hokPiG5SOG2I7b1uXB3rsIFciah9lq0pdgbnSpsu4sKCuOt2au3ZK1ORGpXl U1WlcEh9YP9PJhFCxkahWCL2LqSKqtf9be7/rFxARIM5PkMd/XtifW0d/Px5bMqgsXvyt3/8nLk Uc8z/ZP6BjfzypcJTTLcYWR8iYBkPFrdTlPYjEHTJlvX9RHixmueA1z24C0DjexE4VPBXY79Kfn HZVALa21R9PaaQZXXXcZNoNZku5ge/00pd/NXU/soo7OFGXqRAOLLLJQdaxPeiy756LJcoVHedF xQ5MwiEanqOu7o9NUXddzma2xU+t1DXHp5ccnWotr5J2z9UaAVczlSL+P2v7PKPi8r4BYPvlEAG MAaj9JeH6hU7XurMb+QfLtLQ+C3Q7vPTUdnr2e6NQG2U3FRerE7cq+gf2wHVuaV7D7veizXo5Oy r3PXljUj/+SxO/w== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: YKMG6K56WAXZPGJVOSS4UN6J6ZVP2YWJ X-Message-ID-Hash: YKMG6K56WAXZPGJVOSS4UN6J6ZVP2YWJ X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Eliminate PDS cleanup by using devm_add_action_or_reset() which results in one less error path and smaller cleanup in remove(). Signed-off-by: Krzysztof Kozlowski --- Changes in v3: 1. New patch --- sound/soc/codecs/lpass-macro-common.h | 5 +++++ sound/soc/codecs/lpass-rx-macro.c | 30 ++++++++++++------------------ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/sound/soc/codecs/lpass-macro-common.h b/sound/soc/codecs/lpass-macro-common.h index 3aa9737f2737..21cb30ab706d 100644 --- a/sound/soc/codecs/lpass-macro-common.h +++ b/sound/soc/codecs/lpass-macro-common.h @@ -41,6 +41,11 @@ void lpass_macro_pds_exit(struct lpass_macro *pds); void lpass_macro_set_codec_version(enum lpass_codec_version version); enum lpass_codec_version lpass_macro_get_codec_version(void); +static inline void lpass_macro_pds_exit_action(void *pds) +{ + lpass_macro_pds_exit(pds); +} + static inline const char *lpass_macro_get_codec_version_string(int version) { switch (version) { diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index d47c49c90de3..77e734ad1885 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -3803,11 +3803,14 @@ static int rx_macro_probe(struct platform_device *pdev) if (IS_ERR(rx->pds)) return PTR_ERR(rx->pds); + ret = devm_add_action_or_reset(dev, lpass_macro_pds_exit_action, rx->pds); + if (ret) + return ret; + base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(base)) { - ret = PTR_ERR(base); - goto err; - } + if (IS_ERR(base)) + return PTR_ERR(base); + rx->codec_version = lpass_macro_get_codec_version(); switch (rx->codec_version) { case LPASS_CODEC_VERSION_1_0: @@ -3818,10 +3821,8 @@ static int rx_macro_probe(struct platform_device *pdev) rx->rxn_reg_stride = 0x80; def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_pre_2_5_defaults); reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL); - if (!reg_defaults) { - ret = -ENOMEM; - goto err; - } + if (!reg_defaults) + return -ENOMEM; memcpy(®_defaults[0], rx_defaults, sizeof(rx_defaults)); memcpy(®_defaults[ARRAY_SIZE(rx_defaults)], rx_pre_2_5_defaults, sizeof(rx_pre_2_5_defaults)); @@ -3833,18 +3834,15 @@ static int rx_macro_probe(struct platform_device *pdev) rx->rxn_reg_stride = 0xc0; def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_2_5_defaults); reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL); - if (!reg_defaults) { - ret = -ENOMEM; - goto err; - } + if (!reg_defaults) + return -ENOMEM; memcpy(®_defaults[0], rx_defaults, sizeof(rx_defaults)); memcpy(®_defaults[ARRAY_SIZE(rx_defaults)], rx_2_5_defaults, sizeof(rx_2_5_defaults)); break; default: dev_err(dev, "Unsupported Codec version (%d)\n", rx->codec_version); - ret = -EINVAL; - goto err; + return -EINVAL; } rx_regmap_config.reg_defaults = reg_defaults; @@ -3927,8 +3925,6 @@ static int rx_macro_probe(struct platform_device *pdev) clk_disable_unprepare(rx->macro); err_ver: kfree(reg_defaults); -err: - lpass_macro_pds_exit(rx->pds); return ret; } @@ -3942,8 +3938,6 @@ static void rx_macro_remove(struct platform_device *pdev) clk_disable_unprepare(rx->fsgen); clk_disable_unprepare(rx->macro); clk_disable_unprepare(rx->dcodec); - - lpass_macro_pds_exit(rx->pds); } static const struct of_device_id rx_macro_dt_match[] = { From patchwork Mon Jul 1 07:39:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 810029 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 95CC0C3065A for ; Mon, 1 Jul 2024 07:41:30 +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 BBE69227C; Mon, 1 Jul 2024 09:41:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BBE69227C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1719819688; bh=2LXhDj+OjHwm9PSo2QZCbe9HMxUgBLthEvA3G7WWahk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=nyIxPcxSHxwiLwfwMyfm2IcXklaxkayfXVTD4u9+GlWehLEOuJw3rAX+nBUYbVJOj j8sm2bke5jszO8Y9i5aBAtQiXheMvxy3YrUHQQRZWI0THF3w5Yyla51y6E9Hcyj8+F o2bBavJM+KvprZPYWF+1076tIiHXtHD5Rj8859pk= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 46E69F8062D; Mon, 1 Jul 2024 09:40:14 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A770CF8061D; Mon, 1 Jul 2024 09:40:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 71513F805E8; Mon, 1 Jul 2024 09:40:09 +0200 (CEST) Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7FB05F8028B for ; Mon, 1 Jul 2024 09:39:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7FB05F8028B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=FSZsGU/V Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2ebe6495aedso27457081fa.0 for ; Mon, 01 Jul 2024 00:39:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719819589; x=1720424389; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=S8ExwtvC8Rv0PryTWXbkCNqG0vwkQRpwqxJGJECfGVk=; b=FSZsGU/Vo7Xw5lvQLZz+6Vepy6RFkVbTydQHclPcmiJE+ewVdpAIJ/ePvzr28MfCPq /tfsOT04IphZYKG7beUfarrWgU0T9d6XlXPoHRgJY2PwDJ0ExBMGZ7M/CqupcJOYeC0w 2lL2+1t4KRjPgUHptQ0K75MyK6+vadd5XGGom18WCgmIwfLAdh8Wk1PsSHk8CA62r/j9 XBOkkXyVtVZ2xxvyFLkiFeFQFkY41xwZRlWDOyimlSIOdG/lKkh4tC1Qj2qBZgJC+T6+ KLYO+mT7wMWLMzcXR1LhIK0rxR+LepNu2udADgGMFTmMw5R0u9k+yglhQJ5rbkqvN292 VVDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719819589; x=1720424389; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S8ExwtvC8Rv0PryTWXbkCNqG0vwkQRpwqxJGJECfGVk=; b=KiMrkfSEBZwF+zQeyKYUr+/+dcSmanqFV1qbfsP11qPbn9/c6Hv1fOn/JN/VN1pnlY JgRy32jDLrMK+8WncvUpYSofyOImN5ZCg5yr5WS39Wp4ZZi/KNQ2TyqmxlNMK1RZWbWt RM5vEcPehiZrsKldTvTBhz/83vKzjTQXNUh7n/tykeD9KxMQw959gEoJ6jfES44OS8Ug lu71RgH3H+9expyLDG7UiKaSKJQ2JqVH9hHAs4vxobIPiJUa/Vu4Q2wvlbAfykgcXeqN xAC7Hs2Kgi6u2EHXLkvvv+GHrD3aMFNz4T0vWpVhVbTpPx2Q8DizMgD92H6u7Izpr7Ky 9VBQ== X-Gm-Message-State: AOJu0YygEGfvBbHmM8q8smj7lAOjXF0rf8sIv8crjwV+lQb7HuzgtTJl 4nYurnXqxG0LtBPDkz+oRUz2vAQJe/Bu39kyIItNtzNSxTE3MhE3sCRX+5wcZVo= X-Google-Smtp-Source: AGHT+IHhZFMA0XT6XBDgJiHh2nMdh9If6ijL1sfRHPnrXsiQhUhG2w0sX4XVs3IUQY3q0KizhIYGUw== X-Received: by 2002:a2e:99c2:0:b0:2ec:50fa:1e47 with SMTP id 38308e7fff4ca-2ee5e392b79mr29326251fa.21.1719819588889; Mon, 01 Jul 2024 00:39:48 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0fb9absm9279936f8f.80.2024.07.01.00.39.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 00:39:48 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 01 Jul 2024 09:39:34 +0200 Subject: [PATCH v3 2/6] ASoC: codecs: lpass-rx-macro: Simplify with cleanup.h MIME-Version: 1.0 Message-Id: <20240701-b4-qcom-audio-lpass-codec-cleanups-v3-2-6d98d4dd1ef5@linaro.org> References: <20240701-b4-qcom-audio-lpass-codec-cleanups-v3-0-6d98d4dd1ef5@linaro.org> In-Reply-To: <20240701-b4-qcom-audio-lpass-codec-cleanups-v3-0-6d98d4dd1ef5@linaro.org> To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2459; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=2LXhDj+OjHwm9PSo2QZCbe9HMxUgBLthEvA3G7WWahk=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmgl08N1puNYLwMumh8OH49VAat5Ny9jHNO2iyY 57k6THtXieJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZoJdPAAKCRDBN2bmhouD 1//JD/9zt7hVaxdfvsXkn2F2F19ihi9vDCarT30YkxGA3IVJvvjXPnaZT5C1Xt6V2F3XAMi2V+L yg8KOfBaAgQ10sskIqnXUwJIw5oRsIO60s7mBNjpwHE1O9zykThNWZNRY9zaGQWeJtb/wE53L3T ctOQ9SyRUdKF4zKtquDYRJF7mUht2nNuCmOMWFUbK8xRAYFm0hmgNFjmCULr8X1os/Yyytk282N 81l5OF9q1Cx3KbeWKLrlsJawjiqh3xXxvg5bzBQYGhpfYYyTKkdcK1LyUVVF74NkdxlDepZWXd9 6LDZkFPgtoFW7+F+SeedcrKjpZk8aj+6jhWuNRfKipqK5756AZb4zdeFHTdtcbkc26EzKdh7DSr NOfP2fhazYtTEc0d3Bn8JEDX6zfAGWV4C7YnNKoGHK4TB2tlcLBR5i4pBDEIliiDN+zALH0ChTn inZfFV39xUrYmiSauHUelqX/gVuFOA+/8fiOPfhnsmYmHjWUeENk0k5skw2hjNJoUtqJ3YRKmUl kCYtIaDPlxxgI6oy2VJkKgF9dFvGymPDM1NuuNLme0oGoGljeR9i11DDVTLv0+11xJpGRi74Kjs icJ8U5RNKmVh8h8LO13LDpkpXewQK9gBX4twCTvk+rq/2gI12JUX9mXFvXBjPIWZtiCUbmhfxR0 ADa/jYSfZoHnAjw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: I43ZJSTQVDPFJJO5L6QDYKFWBJLMS2M5 X-Message-ID-Hash: I43ZJSTQVDPFJJO5L6QDYKFWBJLMS2M5 X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allocate the default register values array with scoped/cleanup.h to reduce number of error paths and make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- Not adding Dmitry's Rb tag, because of major change devm->cleanup.h. --- sound/soc/codecs/lpass-rx-macro.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index 77e734ad1885..638f3995a364 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only // Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. +#include #include #include #include @@ -3764,7 +3765,6 @@ static const struct snd_soc_component_driver rx_macro_component_drv = { static int rx_macro_probe(struct platform_device *pdev) { - struct reg_default *reg_defaults; struct device *dev = &pdev->dev; kernel_ulong_t flags; struct rx_macro *rx; @@ -3812,6 +3812,8 @@ static int rx_macro_probe(struct platform_device *pdev) return PTR_ERR(base); rx->codec_version = lpass_macro_get_codec_version(); + struct reg_default *reg_defaults __free(kfree) = NULL; + switch (rx->codec_version) { case LPASS_CODEC_VERSION_1_0: case LPASS_CODEC_VERSION_1_1: @@ -3849,10 +3851,8 @@ static int rx_macro_probe(struct platform_device *pdev) rx_regmap_config.num_reg_defaults = def_count; rx->regmap = devm_regmap_init_mmio(dev, base, &rx_regmap_config); - if (IS_ERR(rx->regmap)) { - ret = PTR_ERR(rx->regmap); - goto err_ver; - } + if (IS_ERR(rx->regmap)) + return PTR_ERR(rx->regmap); dev_set_drvdata(dev, rx); @@ -3864,7 +3864,7 @@ static int rx_macro_probe(struct platform_device *pdev) ret = clk_prepare_enable(rx->macro); if (ret) - goto err_ver; + return ret; ret = clk_prepare_enable(rx->dcodec); if (ret) @@ -3910,7 +3910,6 @@ static int rx_macro_probe(struct platform_device *pdev) if (ret) goto err_clkout; - kfree(reg_defaults); return 0; err_clkout: @@ -3923,8 +3922,6 @@ static int rx_macro_probe(struct platform_device *pdev) clk_disable_unprepare(rx->dcodec); err_dcodec: clk_disable_unprepare(rx->macro); -err_ver: - kfree(reg_defaults); return ret; } From patchwork Mon Jul 1 07:39:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 810028 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 25686C3065A for ; Mon, 1 Jul 2024 07:42:07 +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 0C18421B6; Mon, 1 Jul 2024 09:41:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0C18421B6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1719819725; bh=Ad+uKCGSDe8rakMGGeF23SfGPaAfcaquc5R5IIxLKwU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=EHvunMmdOjPhXGVaKMUkwjUVFF5FCTEoYMJKKxqZwXV6d4fobDF8yMTjMSicSId67 J369MVbW1wyJhkxbwy8n8pdc6ElLQhjtKMbRr42/4kmrWJlK2mbFGztFCOVFORpcGt 6eNK77xu1qLsziD2bOY8MeD/6KmLc5tDtJ4RhBhA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3B1B8F8067C; Mon, 1 Jul 2024 09:40:19 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 93EE8F8067C; Mon, 1 Jul 2024 09:40:19 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 848BCF8061E; Mon, 1 Jul 2024 09:40:15 +0200 (CEST) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4F59DF80238 for ; Mon, 1 Jul 2024 09:39:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4F59DF80238 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=w6ygUhaZ Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3626c29d3f0so1354588f8f.1 for ; Mon, 01 Jul 2024 00:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719819591; x=1720424391; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PicI/VwwrTj8z258jc72WwlXuJ32jmr5AxPeFVRGEyg=; b=w6ygUhaZds8FA+PzlmBT73vHykKtbBf04fDE7fCHuKcCXN5tGrlO3lCA7ihfFG35j7 3H0XcegPKgQmwjsBPe07ZGTkziHf3AUPTTaERz5CkfIRMOHUKkg83giGnwqAwi0GFeqg CUAqOHxeJm9tIpPkOInbAoGUFKdMxHGAHublPCGlub3JzfL9LkDgbjyVtK6x1CdIZbtc T5WHD/X8nuQEKhqMLp9OOd39pCeLeewm57szprJRodTNBR1RSZVVHvLvmn3AVd8yh6/n yG3hp1cay52o0ieb9v48+cKCPPOQvJsMIJpFhXNmlOxBGpekkuCkRMFAvbv3Lu3h39l5 7huw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719819591; x=1720424391; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PicI/VwwrTj8z258jc72WwlXuJ32jmr5AxPeFVRGEyg=; b=ptfecYpy7loXCqGIBFBxBPj4hViWdO+i8pPX3E5gMVkI1gw/CR88vKbJT/Vb6UydXV uFrrLS+mq4a2ycruUlagp04i4+XAIv/xyuNxXvnJsLfSkn1QJOPWt/aXV/KVDvS/5Oon yspHch24ZrkQI1AgVOw80+RltOvw8E3Dl6c8KHUyg9mgKkqUz8cH8BZhRt+s2AnagXLj lKcS6XG4gO0hMDiMwKqSvSgPU1o+lgpGgK/PLLEEhC2+MRGJS0/2Q4fyAlbVJBwRJZ/H e9zzOeG4uSQ3hj6MpcJkmfXRCuUCfzTc/G4cCeyQ53m2qW4KIP7muhlwpEWhj2JKvB8d y/0g== X-Gm-Message-State: AOJu0YyrUtuAnlvrsXKLB4iAoAwCQZZkua7jXvwrQsjy1GU9rvGxT9Mq LBLfYsHHIvgU+R0J5rNEBBJKypUVnIxUTPq98vnoljNlxJ8O06IojrmUVyKWRmo= X-Google-Smtp-Source: AGHT+IEbIUXccj8XAr3Pi+HR8BNf+tQNrJrtODvTWFS72V0zOXk9wxPAEE6XniRcWyYY2+RnDUWHiA== X-Received: by 2002:a05:6000:400c:b0:364:d2b6:4520 with SMTP id ffacd0b85a97d-367756233bbmr4242423f8f.0.1719819591373; Mon, 01 Jul 2024 00:39:51 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0fb9absm9279936f8f.80.2024.07.01.00.39.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 00:39:50 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 01 Jul 2024 09:39:36 +0200 Subject: [PATCH v3 4/6] ASoC: dapm: Use unsigned for number of widgets in snd_soc_dapm_new_controls() MIME-Version: 1.0 Message-Id: <20240701-b4-qcom-audio-lpass-codec-cleanups-v3-4-6d98d4dd1ef5@linaro.org> References: <20240701-b4-qcom-audio-lpass-codec-cleanups-v3-0-6d98d4dd1ef5@linaro.org> In-Reply-To: <20240701-b4-qcom-audio-lpass-codec-cleanups-v3-0-6d98d4dd1ef5@linaro.org> To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov , Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1647; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=Ad+uKCGSDe8rakMGGeF23SfGPaAfcaquc5R5IIxLKwU=; b=kA0DAAoBwTdm5oaLg9cByyZiAGaCXT6gS/qmIwhhz3JQvaEtkfOrO61QWr5ln39pMYOi8vd+e 4kCMwQAAQoAHRYhBN3SYig9ERsjO264qME3ZuaGi4PXBQJmgl0+AAoJEME3ZuaGi4PX1c0QAJl5 DR2okgESZi49MoN1Ws63ZWEeEn6VoZVEJIgmLYJqu4xMAtfgzvHKeFe7GnlgFOmu2GKIualxJc1 tzvu+9iOUyYkxvUojTVjT4obSTdZSPt9VJ3rIpzjVb4rdHhl7KWJZH4wYjBdAeydnGVn6KfDrpd enKKdUpVAQqwA43A5iZjoYYAq8E2UXS7swMDEEEAhRrAgJMoGDQOAijNlXhllzpVg8g0LfmVIMe UG8mSyzUSvUSyTe6dXhqjxsyxmnIPfJbPoqJF2+O2gE4Gktz/mQgcoCApFJ1GWdcGX1vxyO1edS Lamz3HAGA4xqNxzZdM3ByU02sOh6C/d8vCy8VZlmkVvfjOiZrIVmSFHmWsEUEUtDsb9HOnOytIQ edwPxJ5xtvHfCiTVib0RmgWEaOmvpouSSS7LTBNG5swGHpKbXB3VugNyxCTLR7LQavVrFf8IKC7 Vbyd5YTkrXrBjGYk8rC0DLlYxwepXDkOqsa0POpgjUVQsXAUIjZqPzs7xUx5pQh1CMAuPLq2u7W iA0WvmVzvWJ6YvUY89jXfYfSJ2dEnzPZ8hNqYO4cEX6+5oABVfL2FLtz099Y0cIc7m27rTy1+Zt EJoAegi1dzQhXviE9pWxufxXV3Ryb98d8lEtauqgWVgJ4uvCm7EmT/onJU24R7dUcIcFyAhBikV YpnPf X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: WAHCMSTBCC6FZW5QUXHLWL2RLU55D57J X-Message-ID-Hash: WAHCMSTBCC6FZW5QUXHLWL2RLU55D57J X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Number of widgets in array passed to snd_soc_dapm_new_controls() cannot be negative, so make it explicit by using 'unsigned int', just like snd_soc_add_component_controls() is doing. Reviewed-by: Dmitry Baryshkov Signed-off-by: Krzysztof Kozlowski --- include/sound/soc-dapm.h | 2 +- sound/soc/soc-dapm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 667ecd4daa68..12cd7b5a2202 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -457,7 +457,7 @@ int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol, int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *uncontrol); int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, - const struct snd_soc_dapm_widget *widget, int num); + const struct snd_soc_dapm_widget *widget, unsigned int num); struct snd_soc_dapm_widget *snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, const struct snd_soc_dapm_widget *widget); struct snd_soc_dapm_widget *snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 16dad4a45443..32cc90d09bc2 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3857,7 +3857,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_new_control); */ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, const struct snd_soc_dapm_widget *widget, - int num) + unsigned int num) { int i; int ret = 0;