From patchwork Wed Nov 9 17:08:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier MOYSAN X-Patchwork-Id: 17714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp466528wru; Wed, 9 Nov 2022 09:32:10 -0800 (PST) X-Google-Smtp-Source: AMsMyM618Xdo6CfAQ6tMmvgfr71ic79p2dXO9k0xqUe4tpA6bRy30MZOp7BzZZ3mGmLKy20BMhKq X-Received: by 2002:aa7:8888:0:b0:56d:41a9:dbb3 with SMTP id z8-20020aa78888000000b0056d41a9dbb3mr56394765pfe.15.1668015130424; Wed, 09 Nov 2022 09:32:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668015130; cv=none; d=google.com; s=arc-20160816; b=IveRSprrBPUc+l7P/oy5zsI7Zjl1z3GC2xKTasCn4c07zNxCHBsIvbwxajdyiyNpDZ XdTjfEVOf5uCfHxt8/9RLfsxyVJID8lZMKKJChmtTf6jdVu2mmTnQGXLqEpZULjvDGhH pjJCbYISXGU6G3GdKYubom1Z8uKLzwgZvMLYYvUe71FXb/zVe9kF2IJb5G57iP975VoV oZ8ndBbLW0JF+jFCF2XDc8h6ayk7CryfSvzdD2RbC9Lph76FUJaNbjmEOk3h+H/ygklb GzCUN1+Z1OfiBr5gqM2U+yxAuoGg9Sl+KEJC0JnOOcqfQaDJYywie2TEkNARjgQHvjso 9wDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TylSzxW41j5uV+QK5Kbt4olHN8IHl8axagRqf9wIm/A=; b=ETwVsbLqI359g1/OmDh1sHs2NtZmTkmFD8/CiewZaY3AC+Cptcw9zznzdzy1qEt8WQ oKG4IMhlvvNh5/vJE17NNqP9q8IjM9gHaVzpgDcFnAhseMU9C8VNtjWzSH2eBXL6B5gS 6k96b5VRpoTX9RENyAAeC5RdIANvUcvwdmVbb+aIEwOJ81T4UbDN156iC0ilHyVMrLtj XMCUGqIm6gfcIA9ntw/T1evcUzxZEV4HdxkhJnoS0aC1c/LxmrQuqqdoxTa91YE9NgBD 7La7gKNDU1KKM9uc0+tESEdIvJSnMOA0C0wYSkzVDsTIeS6Yp7+hhtxvxmdsbkC9fv1p CXRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=WxJDI78Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t67-20020a625f46000000b0054764d871b5si16177447pfb.230.2022.11.09.09.31.56; Wed, 09 Nov 2022 09:32:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=WxJDI78Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231277AbiKIRLX (ORCPT + 99 others); Wed, 9 Nov 2022 12:11:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbiKIRLU (ORCPT ); Wed, 9 Nov 2022 12:11:20 -0500 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52CB8F5B4 for ; Wed, 9 Nov 2022 09:11:19 -0800 (PST) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2A9GmoS9025098; Wed, 9 Nov 2022 18:10:00 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=selector1; bh=TylSzxW41j5uV+QK5Kbt4olHN8IHl8axagRqf9wIm/A=; b=WxJDI78QH4j2s/IJRetCyvfrd4cC2obfF27F6n6nbiVU2s6Jni6ZMU9DRLq1eMPVvMw2 qM7MkWyamTdEQvzOxlCeJaRtf7cgrIbbVDPRg9y2UhOJqibZjzi0t6jQcHktOhuvtUA9 5MG5Bu8raA6oI5NQZ+UaY6cQUHOEwuQbuN0ZzT/yypTxeyd8La1UGbXt66TlEtJChzJL CtBH7XPoTyeU43mtj//iSxz6YXOArBgyxzRegSYGMoHiVEYo51797rjoDBy+PVSCbNdn NzPg4NMXCnl8wk6+glUv7SGvdFh2gNuSa8StStCzjs8kmbRKn13jj2WTgOYn7sOXDfBn gw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3kpyjqjp28-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Nov 2022 18:10:00 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 40AD7100038; Wed, 9 Nov 2022 18:09:53 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 7384E2291B0; Wed, 9 Nov 2022 18:09:53 +0100 (CET) Received: from localhost (10.252.3.44) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Wed, 9 Nov 2022 18:09:53 +0100 From: Olivier Moysan To: Olivier Moysan , Arnaud Pouliquen , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Maxime Coquelin , Alexandre Torgue CC: , , , Subject: [PATCH] ASoC: stm32: dfsdm: manage cb buffers cleanup Date: Wed, 9 Nov 2022 18:08:49 +0100 Message-ID: <20221109170849.273719-1-olivier.moysan@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.252.3.44] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-09_06,2022-11-09_01,2022-06-22_01 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749040633549949337?= X-GMAIL-MSGID: =?utf-8?q?1749040633549949337?= Ensure that resources allocated by iio_channel_get_all_cb() are released on driver unbind. Signed-off-by: Olivier Moysan --- sound/soc/stm/stm32_adfsdm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c index 643fc8a17018..837c1848d9bf 100644 --- a/sound/soc/stm/stm32_adfsdm.c +++ b/sound/soc/stm/stm32_adfsdm.c @@ -304,6 +304,11 @@ static int stm32_adfsdm_dummy_cb(const void *data, void *private) return 0; } +static void stm32_adfsdm_cleanup(void *data) +{ + iio_channel_release_all_cb(data); +} + static struct snd_soc_component_driver stm32_adfsdm_soc_platform = { .open = stm32_adfsdm_pcm_open, .close = stm32_adfsdm_pcm_close, @@ -350,6 +355,12 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) if (IS_ERR(priv->iio_cb)) return PTR_ERR(priv->iio_cb); + ret = devm_add_action_or_reset(&pdev->dev, stm32_adfsdm_cleanup, priv->iio_cb); + if (ret < 0) { + dev_err(&pdev->dev, "Unable to add action\n"); + return ret; + } + component = devm_kzalloc(&pdev->dev, sizeof(*component), GFP_KERNEL); if (!component) return -ENOMEM;